AgileFx
Encyclopedia
AgileFx is an Open Source
Open source
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...

  ORM
Object-relational mapping
Object-relational mapping in computer software is a programming technique for converting data between incompatible type systems in object-oriented programming languages. This creates, in effect, a "virtual object database" that can be used from within the programming language...

 for the .NET Framework, with features comparable to ADO.NET Entity Framework
ADO.NET Entity Framework
ADO.NET Entity Framework is an object-relational mapping framework for the .NET Framework.-Overview:ADO.NET Entity Framework abstracts the relational schema of the data that is stored in a database and presents its conceptual schema to the application...

. It uses LINQ to SQL underneath, and extends LINQ to SQL to match the more advanced features found in Microsoft Entity Framework; while retaining its performance benefits.

In a nutshell, AgileFx works by translating (at runtime) LINQ queries on Domain Models involving Inheritance and Many-to-Many relationships into simpler queries involving plain database tables, which can be processed by LINQ to SQL or a similar ORM. Hence architecturally, AgileFx is not tied to LINQ to SQL; any LINQ provider which supports queries on table entities (such as IQToolkit) can be used instead.

AgileFx 1.0 beta was released in March 2010, with the final version expected in August 2010.

Features

AgileFx 1.0 supports the following features:
  • Many to Many Relationships
  • Inheritance (Table per Type)
  • Eager Loading
  • Parallel Queries
  • Caching
  • Full LINQ Support
  • Visual Studio Integration


The primary goal of version 1 was to achieve feature parity with ADO.NET Entity Framework.

Using the framework

AgileFx supports all standard LINQ queries, and the queries are deliberately similar to Entity Framework.


Entities entities = new Entities;
var users = from user in entities.User
where user.Firstname

"Mark"
&& user.Designation

"IT Manager"
select user;

foreach(var user in users)
{
Console.WriteLine("Firstname {0}, Lastname {1}", user.Firstname, user.Lastname);
}


The following is an example of Eager loading. Note that the loaded path (u.Account) is specified as an expression instead of a string for better type safety.


Entities entities = new Entities;
var users = entities.CreateQuery.LoadRelated(u => u.Account)
.Where(user => user.Firstname

"Mark"
&& user.Designation

"IT Manager");
foreach( var user in users)
{
Console.WriteLine("User lastname {0}, Account Status {1}",
user.Firstname, user.Account.Status);
}


The following is an example of caching. When this method is called for a second time, the objects are returned from the in-memory cache instead of the database.

public List GetUsers(EntityContext entityContext, long tenantId)
{
var cacheParams = new CacheParams
{
ItemKey = "users_" + tenantId,
Timeout = new TimeSpan(0, 2, 0)
};
var users = entityContext.Cache.Invoke(
(tId, _context) => _context.CreateQuery.Where(u => u.Id tId).ToList,
this, tenantId, cacheParams);
return users;
}

Modeling tools

AgileFx includes designer support for Visual Studio 2008 and 2010, which lets the developer create Domain Models. The designer supports importing the models from an existing database, or a Model-First approach which allows the developer to design the entities first and export them later to a database.
External Links
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK