c# - Create relation between classes or create new store procedure -
i have 2 tables. customer , account , there structure this.
--------------- -------------- customer table account table --------------- -------------- cust_id acc_id cust_name cust_id address acc_number phone balance
and have 2 classes in project.
class customer { public int cust_id { get; set; } public string cust_name { get; set; } public string address { get; set; } public string phone { get; set; } } class account { public int acc_id { get; set; } public int cust_id { get; set; } public string acc_number { get; set; } public decimal balance { get; set; } }
now have 2 store procedures, 1 customers , 1 accounts. want retrieve records in form.
cust_id, cust_name, acc_number, balance
now want ask how joins these 2 tables. should make new store procedure
return result set or should mapping in c#
code. if make new sore procedure need create new class store result set in form want. increase 1 more class in project. if first read customers , accounts, how create relation between these data. or there other way handle kind of situation.
thank you.
class customer : account { public int cust_id { get; set; } public string cust_name { get; set; } public string address { get; set; } public string phone { get; set; } } class account { public int acc_id { get; set; } public string acc_number { get; set; } public decimal balance { get; set; } }
join query can wrote in stored procedure inherit account class customer class . no need create new class
Comments
Post a Comment