New Enhanced Object tracking service (OTS)
A. Update Tracking
Take this example
Book book = (from book in context.Books
where book.Id = 1 ).Single();
// now update a property
book.ISBN = "110";
LinqExtender knows the object is updated and thus will call Query<T>.UpdateItem(Bucket). So, in your provider to support
object update you need to override the following
protected bool UpdateItem(Bucket item)
Bucket contains the updated property- value map
//finally do a return , if true, then only the
//collection will be updated or
//it will revert back to the old one and raise an OnError event.
B. Get by Idenitty
protected override T GetItem(Bucket item)
T singleObject = GetItThoughUniqueValue(...);
This will be called by the toolkit for queries like
var query = from book in context.Books
where book.Id == 1
Book book = query.Single();
Here, Id is a unique field defined by UniqueIdentifier attribute. This saves few if-elses in Query<T>.Process. when getting single unique item. If you are writting a provider that auto generates the query depending on Bucket properties, you can do that well with Quey<T>.Process and in that case you dont need override this for Identity calls, but if your building a serviced API like LINQToFlickr and you want your GetById and Search in differnent scope rather using IF-ELSE-THEN in Query<T>.Process , then it will be useful.
C. Update with item add tracking
In query object for tracking new object you dont need to override the IsNew property of QueryObjectBase anymore to identify if an object is new or not.
Finally, the return type of AddItem, UpdateItem, RemoveItem is changed from void to bool, which requires you to do success check and return a bit status , status := false will ensure the main query collection is not updated with user changes and will raise proper a OnError event.Others
1. Use bucket.Items..
.IsUniqe and bucket.UniqueItems to check for properties with UniqueIdentifierAttribute
2. Added OriginalEnityName attribute for class
like the OrignalFieldName for propeties
. If you have table name other than class name You can use this attribute to map it with original table name.
In that case bucket.Name == the attribute name. Patch 1.4.1 update 23 Oct, 2008
- Fixed Complex member access issue in orderby clause
- Added Bucket.FindAttribute for queryting custom object attributes.
DbTypeAttribute attribute = (DbTypeAttribute)item.FindAttribute(typeof(DbTypeAttribute));
- Added auto table creation (from config: executeDDL = true) for OpenLInqToSql sample ORM.