This project is read-only.
Magiq-to-sql works using Linq-to-sql queryables. It uses Linq-to-sql in order to generates the where clauses and the property assignments.

Updates
It wil generate one single update statement of the "UPDATE <table> SET <column = value> FROM <clause>" form for each class being updated. For example:

products.Where( x=> x.ExpirationDate <= DateTime.Now ).Set( x=> x.State, ProductState.Expired ).Update();


will generate one single update, because we are updating only the table that maps Product. But

products.Where( x=> x.ExpirationDate <= DateTime.Now ).Set( x=> x.State, ProductState.Expired )
                                                      .Set( x => x.Category.HasExpiredProducts, true)
                                                      .Update();

will generate two updates, one for the table that maps Product and one for the table that maps Category.

Deletes
It wil generate one single delete statement of the "DELETE FROM <clause>" form.

Inserts
It wil generate one single insert statement of the "INSERT INTO <table> ( <columns> ) SELECT <values> FROM <clause>" form.

Mass operation over collections
It's fully supported by Magiq-to-sql. For example:

store.Update( x => x.Products.Where( x=> x.ExpirationDate <= DateTime.Now ).Set( x=> x.State, ProductState.Expired ));

will generate:

UPDATE [t0] SET [t0].[State] = @p3 WHERE [t0].ExipirationDate <= @p1 AND [t0].StoreId = @p2


Linq-to-sql features
Since the where clauses are generated using Linq-to-sql, it should supports the same things. Anyway, the tested features includes:
  • Inheritance
  • Composite primary and foreign keys.
  • Group by
  • Order by
  • BulkCopy plugin

Reflection
Magiq uses dynamic generated methods in order to avoid reflection calls.

Last edited Apr 29, 2011 at 12:04 AM by ivos, version 5

Comments

No comments yet.