I'd like to insert my UserCompany
object into the database trought a single method. Such as passing the element to this function, take it and "insert in the right table".
Usually in Entity (such as LINQ to XML) I do somethings like:
db.Company.UsersCompany.Add(UserCompany);
db.SubmitChanges();
but the problem here is that I need to specify the table UsersCompany
and Company
before using the .Add()
.
I'd like (since I want to do ONE function for the insert for each type of object/table) get rid of this. Such as having a:
UserCompany.InsertMySelf();
or
db.SmartAdd(UserCompany);
and it know how to insert the table, where and how, automatically.
Is it possible to do this? Is there any strategies?