Concurrency erro when deleteing or updating multiple primary key fields
Using the Adapter template group which ships with LLBLGen Pro, you'll notice that there will be two VS. This section describes code referencing both projects as it needs to interact with the database.The code used in the Adapter section of the documentation uses the General preset, which results in one class per entity.Another way to instantiate this same entity is via a related entity. If Customer is in an inheritance hierarchy, the fetch is polymorphic.Adapter however doesn't support automatic data loading when you traverse a relation, all data has to be fetched up-front. This means that if the order entity, in this case order 10254, has a reference to a derived type of Customer, for example Gold Customer, the entity returned will be of type Gold Customer. Entities can have other unique identifying attributes and are defined in the database as unique constraints. We require an adapter for this Dim adapter As New Data Access Adapter() adapter.One way to instantiate the entity in an object is by passing all primary key values to the constructor of the entity class to use: This will load the entity with the primary key value of "CHOPS" into the object named customer, directly from the persistent storage. Consider the following situation: a new Employee Entity instance employee, which has an autonumber primary key field, and a new Order Entity instance order. Employee = employee;, and the order is saved (or the employee), the field order.
If the entity object isn't in the Context object, a new entity object is returned. Get(New Customer Entity Factory(), "CHOPS"), Customer Entity) If customer. This can be helpful if you want to refetch the entity later.If you want two classes per entity, you've to use the Two Classes preset, which would result in two classes per entity, one being named Myentity Name Entity, the one you'd use in your code like the code in this section.All entity classes derive from a central, generated base class called Common Entity Base.// [C#] Customer Entity customer = new Customer Entity(); customer. Next, we have to mark the new, empty entity object as not being new, so Save Entity() will use an UPDATE query, instead of an INSERT query. After that comes the altering of a field, in this case "Phone", and the call of Save Entity(). If you want that, specify 'true' with the Save Entity() call.Doing updates this way can be very efficient and you can use very complex update constructs when you apply an Expression to the field(s) to update.