Update in 1.3.2

Support of Muliple where clause per item


protected override void Process(LinqExtender.Interface.IModify<T> items, Bucket bucket)
  // the following line with throw a "not supported by the provider" exception
  // if multiple where clause for same item is used in this case "id"
  objec obj = bucket.Items["Id"].Value;
  // if provider author want to support mulple queries like
  // where book.Id > 1 && book.Id < 3 , they can take the advantage of the following
  IList<BucketItem.QueryCondition> conditions = bucket.Items["Id"].Values
  foreach (BucketItem.QueryCondition condition in conditions)
    // do whatever necessary, but properties are
    obj value = condition.Value;
    RelationType relationType = condition.RelationType;

Updates in 1.3.1

1. In memory Sort depending on the orderby query support.

protected override void Process(LinqExtender.Interface.IModify<T> items, Bucket bucket)
   // do all work
   // get the result
   // finally intead of
   items.AddRange(IEnumerable<T>, true); 
   // which does a in-memory order by if "order by" clause is used in query.

Simalary, for single item fill up, lets say you take an item from the source , do some work and add it to the collection one by one , then items.Sort can be used.

protected override void Process(LinqExtender.Interface.IModify<T> items, Bucket bucket)

   foreach (T item in result)
     // do some work 
   // the following line will do a sort on the orderby query.	

Sort is useful for creating serviced api. For example. for flickr i cant pass orderyby for popular tags.
In this case the in-memory sort will be used.

2. Added IDisposable for QueryObjectBase, in this way provider can be used in using (..) { } block and provider writers can write appropiate clean up code.
3. Bug Fix: Differnet anyomous query for the same query context causes crash.

Updates in 1.3

1.If any BucketItem is changed inside Add methoed of implmented Query<T> of Bucket.Items collection then it will reflected back to the referencing object.
This is useful when we need to track back some property (lets say Id) after adding the object to the datasource.

Photo photo  = new Photo();
photo.Title = "Test";
Assert.IsTrue(photo.Id == 0);
Assert.IsTrue(photo.Id > 0);

2. Complex parameter support by using Delegate.DynamicInvoke.

For example, we can do the following

var query = from q in _queryContext
where q.Author == _list[2].Author // complex type query parameter.
select q;

3. Query.Count added, typical example

var query = (from q in _queryContext
             orderby q.LastUpdated descending
             select new { q.Id, q.Title, q.LastUpdated }).Take(1);

int count = query.Count(); 

13. Bucket.QueryVisible , true [if, LinqVisible(true) added on a property, it can be used in a query] , false
[If, LinqVisible(false)] , LinqVisibleAttribute was previously known as UseInQueryAttribute.

4. OnSuccess and OnError event handler included. This is for , people using custom provider made on Linqextender , can take the
advantage of it. For example, writing logs.

OnError is raised for any exception in Process, Add , Remove overrides.
OnSuccess is raised, after doing db.SubmitChanges(), for successful data action.

Updates in 1.2

1. Supports new type quries , like the following

 var query = (from q in context
              orderby q.LastUpdated descending
              select new { q.Id, q.Title, q.LastUpdated }).Take(1);

2.New Support for "<", ">" , "<=", ">=" along with "=" Expression type.
This are tracked by RelationType enum, and is passed with Bucket object to Process method exposed by LinqExtender,
where user can take logical decision based on the Relation Type.

Typical expression

var query = from q in context
                  where q.Age < 23
                  select q;

for this, inside the bucket wrapper, passed in the Process Routine, we can retrive the value in the followng way.

int value = (int) bucket.Items["Age"].Value ;
RelationType relType = bucket.Items["Age"].RelationType;

Here , the assinged value for value and relType are 23 and RelationType.LessThan respectively.

3. Handy shortcuts for iterating elements and getting property values.
4. Added new UniqueIdentifierAttribute
6. Renamed the Class from SqlContext to SqlQuery to keep it similar with other Query class.
7. Updated Util class with some helper methods.
8. updated TinyLinqToSql provider, it now does queries with CTE(Common Table expression) for selective item retrival by Take
and skip

9. Renamed TinyLinqToSql to OpenLinqToSql.
10. Added NUnit test class. For running Nunit test class, u need to download the Nunit Gui tool, just build the project and point the test dll to it.

Updates in 1.1

1.In query support for orderby Ascending / descending. Inside Process method , we can do the following.

if (bucket.OrderByCaluse != null)
   // there are two items to check for 
   1. bucket.OrderByCaluse.FieldName , the item name or constant on which order by is made, 
      if OriginalNameAttribte  is used on a Property , 
      then the name will be taken from it or it will be the property name.
   2.  bucket.OrderByCaluse.IsAscending = true/ false 

2. Take, Skip , First , Single , Last method calls are possible to get specific object.

  var query = (from q in _queryContext
  select q).Take(1).Skip(2);

  Book book  = query.Single()/ First();

Updates in 1.0

1. Basic query, add , delete.
2. Where clause can have multiple segments separated by &&
3. enum varibles can be used for comparison.
4. Can be used both in instance and static class.

Overview of Bucket object

-IDictionary<string, BucketItem> Items - > where string is the property name of the query object, BuckItem represents how the Property is treated and used in query.
-ItemsToTake : default null , if Take is not specified in query.
- ItemsToTake : default 0, if Skip is not specified in query.
-UniqueItems : string[], contains the name of property on which UniqueIdentifierAttribute or its derivative is used.

- Name : Different if the used With OriginalFieldNameAttribute, or less it is same as property name
- Value : value in the query , for which the property is compared.
- Unique : True , if UniqueIdentifierAttribute or its inherited type is used on Property, Here one can Use UniqueIdentifierAttribute directly on property or can any inherited like PrimaryKeyAttribute that inherites the UniqueIdent
- RelationType : Equal, Lessthan , etc.
- Values : BucketItem.QueryCondition , holds Value and RelationType for multiple where caluse per field

Last edited Mar 30, 2008 at 4:01 PM by mehfuzh, version 10


No comments yet.