This question is locked. New answers and comments are not allowed.
Hi All,
We use to use Entity frame work most of the time, now we are going to shifted to OpenAccess and have good experience with it.
But we face some kind of problems with openAccess as follows.
If we need to Update or Edit an object what we did with EF is just change the state of the object and do the save changes.
ex:
public void Update(Customer customer, Context context) {
try {
context.Customers.Add(customer);
context.Entry(customer).State = EntityState..Modified;
context.SaveChanges();
}catch (Exception exp) { throw exp; }
}
But in OpenAccess we feel that always we need to load object in to context before doing any update or delete.
ex:
public void UpdateCustomer(Customer customer)
{
try
{
ObjectKey objectKey = new ObjectKey("Customer", new[] { new KeyValuePair<string, object>("ID", customer.ID) });
entity = context.Customers.Get(objectKey);
entity.UpdatedOn = System.DateTime.Now;
entity.Name = customer.Name;
context.SaveChanges();
}
catch (Exception ex) { throw ex; }
}
Is there a way to update object without loading it to context again like in EF.
Development Team
We use to use Entity frame work most of the time, now we are going to shifted to OpenAccess and have good experience with it.
But we face some kind of problems with openAccess as follows.
If we need to Update or Edit an object what we did with EF is just change the state of the object and do the save changes.
ex:
public void Update(Customer customer, Context context) {
try {
context.Customers.Add(customer);
context.Entry(customer).State = EntityState..Modified;
context.SaveChanges();
}catch (Exception exp) { throw exp; }
}
But in OpenAccess we feel that always we need to load object in to context before doing any update or delete.
ex:
public void UpdateCustomer(Customer customer)
{
try
{
ObjectKey objectKey = new ObjectKey("Customer", new[] { new KeyValuePair<string, object>("ID", customer.ID) });
entity = context.Customers.Get(objectKey);
entity.UpdatedOn = System.DateTime.Now;
entity.Name = customer.Name;
context.SaveChanges();
}
catch (Exception ex) { throw ex; }
}
Is there a way to update object without loading it to context again like in EF.
Development Team