I'm not really sure whether the benefits are worth it unless you need very high quality code and for larger applications. I'm not sure why i feel this and whether this is due to compartmentalizing the LINQ code or whether its just TDD on LINQ code which can be tested via a test DB i suspect its the TDD.
Still storing all the sql in the various repositories is a plus.
}
---------------------------------------------------------------------------------------------------------------------------internal class ProvinceRepositry : RepositryBase<Province>, IProvinceRepositry{public ProvinceRepositry()base(new ProvinceUnitOfWork())public ProvinceRepositry(IUnitOfWork<Province> work)base(work)#region IProvinceRepositry Memberspublic ProvinceCollection GetWorld(string worldname)throw new System.NotImplementedException();public ProvinceCollection GetWorld()throw new System.NotImplementedException();public Province Get(int id)throw new System.NotImplementedException();public void Update(Province prov)Guard.ArgumentNotNull(prov, "PROVINCE"); public void Create(Province prov)Guard.ArgumentNotNull(prov, "PROVINCE"); throw new System.NotImplementedException();
:
{
}
:
{
}
{
}
{
}
{
}
{
}
{
}
#endregion
}
-------------------------------------------------------------------------------------------------------------------------
{
{
}
#region
{
context.SubmitChanges();
}
#endregion
#region
{
context.Dispose();
}
#endregion
}
internal class ProvinceUnitOfWork :UnitOfWorkBase<Province>, IUnitOfWork<Province>DataContext context;public ProvinceUnitOfWork()this.context = DataContextFactory<DataClassesDataContext>.GetThreadScopedDataContext(); ; IUnitofWork<World> Memberspublic override bool ReadOnly { get { return !context.ObjectTrackingEnabled; } set { context.ObjectTrackingEnabled = !value; } }public override void SubmitChanges() IDisposable Memberspublic override void Dispose()internal interface IProvinceRepositry{ProvinceCollection GetWorld(string worldname);ProvinceCollection GetWorld();Province Get(int id);void Update(Province prov);void Create(Province prov);
Print | posted on Thursday, January 15, 2009 12:38 AM