It is convenient when using LINQ to define a strong-typed unit of work class which exposes class-specific properties that wrap the Query<TEntity> method. For example:

1public class SampleUnitOfWork : UnitOfWork 2{ 3 public IQueryable<Member> Members 4 { 5 get { return this.Query<Member>(); } 6 } 7}
This allows you to refer to myUnitOfWork.Members
. Because the strong-typed class
derives from UnitOfWork, you can also call all the usual unit of work methods such as
SaveChanges through this class.
Creating the Strong Typed Unit of Work Class
If you use the LightSpeed designer, and your project targets .NET 3.5 or above, the designer creates a strong typed unit of work class for you. The name of the class is the model name followed by UnitOfWork, e.g. VideoSharingUnitOfWork.
Otherwise, you can create the class by hand following the pattern shown above.
Creating a Strong Typed Unit of Work Object
To create an instance of a strong typed unit of work, set up your LightSpeed parameters in a LightSpeedContext<TUnitOfWork> class instead of a normal LightSpeedContext, and call CreateUnitOfWork in the usual way.
If all (or most) of the places where you work with the IUnitOfWork object share a common base class—for example, a set of controller objects in a model-view-controller design, all of which derive from a ControllerBase class—then it may also be convenient to declare a property of this type in that common base class.