insert record other than AddToEntityName
-
Hi All, Till now i had seen one method to insert a record to the entity using AddToEntityName(EntityObject) ... but is there any other method instead of passing the EntityObject as parameter if we send the FieldNames and FieldValues as Parameters..... suppose say i have entity as Customer.. and fields are Customer | ------->CustomerID ------->Customer Name ------->Place ------->DOB basic method --- entity.AddToCustomer(objCustomer); is there any way to have like this... string str = "CustomerName=xxxx,Place=hyd,Dob=08-04-78"; entity.SomeMethod(str); a record is inserted to the table. Thanks in advance ;)
Chaitanya.E chaitanya@cosmonetsolutions.com
-
Hi All, Till now i had seen one method to insert a record to the entity using AddToEntityName(EntityObject) ... but is there any other method instead of passing the EntityObject as parameter if we send the FieldNames and FieldValues as Parameters..... suppose say i have entity as Customer.. and fields are Customer | ------->CustomerID ------->Customer Name ------->Place ------->DOB basic method --- entity.AddToCustomer(objCustomer); is there any way to have like this... string str = "CustomerName=xxxx,Place=hyd,Dob=08-04-78"; entity.SomeMethod(str); a record is inserted to the table. Thanks in advance ;)
Chaitanya.E chaitanya@cosmonetsolutions.com
You will only get something like that if you write a WCF service and have the parameters passed. Even then, your parameters would be strongly typed. Overall, though, I don't understand what you have against creating a new entity and calling an add. It guarantees your data is strongly typed and valid which cuts down on database chattiness. You will never find a database method where you are passing name value pairs to create a record.