Answer the question
In order to leave comments, you need to log in
Autogenerator c# classes for stored procedures?
Good afternoon.
I came across new projects in C# + MsSQL
There were only dlls, I used dotPeek to uncompile. I
found that a number of classes ending in Result are actively used to communicate with the database and get data from it, the classes themselves are apparently generated, and not written by hand. I came to this conclusion because there are a lot of them (for each stored procedure). Well, Google gave a lot of results on auto-generation of classes for stored ones. But I have not found such a generator. Here is an example result class for storage:
using System.Data.Linq.Mapping;
namespace DatabaseLib
{
public class FindUsersResult
{
private long? _Id;
private string _Login;
[Column(DbType = "BigInt", Storage = "_Id")]
public long? Id
{
get
{
return this._Id;
}
set
{
long? nullable1 = this._Id;
long? nullable2 = value;
if ((nullable1.GetValueOrDefault() != nullable2.GetValueOrDefault() ? 1 : (nullable1.HasValue != nullable2.HasValue ? 1 : 0)) == 0)
return;
this._Id = value;
}
}
[Column(DbType = "NVarChar(255)", Storage = "_Login")]
public string Login
{
get
{
return this._Login;
}
set
{
if (!(this._Login != value))
return;
this._Login = value;
}
}
}
}
Answer the question
In order to leave comments, you need to log in
Incredibly high probability that this is a standard DBML generator, it is built into the studio.
Try adding linq to sql classes to the project. And already add the dbo.FindUsersResult procedure to it. I think the generated *.cs-file will be very similar to yours.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question