namespace LINQTOSQLFromScraTCH
{
public class SP_GetAllCustomersResult
{
private int _CID;
private string _CName;
private string _CPassword;
[Column(Storage = "_CID", DbType = "Int NOT NULL")]
public int CID
{
get
{
return this._CID;
}
set
{
this._CID = value;
}
}
[Column(Storage = "_CName", DbType = "VarChar(50)")]
public string CName
{
get
{
return this._CName;
}
set
{
this._CName = value;
}
}
[Column(Storage = "_CPassword", DbType = "VarChar(50)")]
public string CPassword
{
get
{
return this._CPassword;
}
set
{
this._CPassword = value;
}
}
}
[Database(Name = "Lab5")]
public class clsMyContext : DataContext
{
public clsMyContext(string connection) : base(connection)
{
}
[FunctionAttribute(Name="dbo.SP_GetAllCustomers")]
public ISingleResult SP_GetAllCustomers()
{
IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())));
return ((ISingleResult)(result.ReturnValue));
}
}
}
{
public class SP_GetAllCustomersResult
{
private int _CID;
private string _CName;
private string _CPassword;
[Column(Storage = "_CID", DbType = "Int NOT NULL")]
public int CID
{
get
{
return this._CID;
}
set
{
this._CID = value;
}
}
[Column(Storage = "_CName", DbType = "VarChar(50)")]
public string CName
{
get
{
return this._CName;
}
set
{
this._CName = value;
}
}
[Column(Storage = "_CPassword", DbType = "VarChar(50)")]
public string CPassword
{
get
{
return this._CPassword;
}
set
{
this._CPassword = value;
}
}
}
[Database(Name = "Lab5")]
public class clsMyContext : DataContext
{
public clsMyContext(string connection) : base(connection)
{
}
[FunctionAttribute(Name="dbo.SP_GetAllCustomers")]
public ISingleResult
{
IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())));
return ((ISingleResult
}
}
}
---------------
Calling
static void Main(string[] args)
{
clsMyContext context = new clsMyContext(@"Data Source=.\sqlexpress;Initial Catalog=Lab5;Integrated Security=True");
var MyQuery = context.SP_GetAllCustomers();
foreach (var item in MyQuery)
{
Console.WriteLine(item.CName);
}
}
{
clsMyContext context = new clsMyContext(@"Data Source=.\sqlexpress;Initial Catalog=Lab5;Integrated Security=True");
var MyQuery = context.SP_GetAllCustomers();
foreach (var item in MyQuery)
{
Console.WriteLine(item.CName);
}
}
0 التعليقات:
إرسال تعليق