Hopefully made some improvements to framework on monkey-see-monkey-do basis. Are they valid and useful!

Aug 19, 2014 at 9:16 PM
Edited Aug 20, 2014 at 1:27 AM
I have made some changes to the framework files, to include:
  • what I think is missing Async related methods.
  • a method to create an entity.
Please let me know if these changes are valid or have any dangerous side effects. As I have only a very basic understanding of framework.

A number of files had lines of code added to them. Those files are, together with the new lines:

IRepositoryAsync.cs
IRepositoryAsync<T> GetRepositoryAsync<T>() where T : class, IObjectState, new();
IRepository.cs
TEntity Create()
Repository.cs
public virtual TEntity Create()
{
   return new TEntity() { ObjectState = ObjectState.Added };
}
public virtual IRepositoryAsync<T> GetRepositoryAsync<T>() where T : class, IObjectState, new()
{
   return _unitOfWork.RepositoryAsync<T>();
}
IService.cs
TEntity Create();
Service.cs
public virtual TEntity Create() { return _repository.Create(); }
A number of files had a line changed just to include the new() constraint at the end of the line. Those files are, together with the changed line:

IUnitOfWorkAsync.cs
IRepositoryAsync<TEntity> RepositoryAsync<TEntity>() where TEntity : class, IObjectState, new();
IUnitOfWork.cs
IRepository<TEntity> Repository<TEntity>() where TEntity : class, IObjectState, new();
IRepository.cs
IRepository<T> GetRepository<T>() where T : class, IObjectState, new();
UnitOfWork.cs
public IRepository<TEntity> Repository<TEntity>() where TEntity : class, IObjectState, new()
public IRepositoryAsync<TEntity> RepositoryAsync<TEntity>() where TEntity : class, IObjectState, new()
Repository.cs
public class Repository<TEntity> : IRepositoryAsync<TEntity> where TEntity : class, IObjectState, new()
public IRepository<T> GetRepository<T>() where T : class, IObjectState, new()
QueryFluent.cs
public sealed class QueryFluent<TEntity> : IQueryFluent<TEntity> where TEntity : class, IObjectState, new()
RepositoryProvider.cs
public IRepositoryAsync<T> GetRepositoryForEntityType<T>() where T : class, IObjectState, new()
RepositoryFactories.cs
public Func<IDataContextAsync, IUnitOfWorkAsync, dynamic> GetRepositoryFactoryForEntityType<T>() where T : class, IObjectState, new()
protected virtual Func<IDataContextAsync, IUnitOfWorkAsync, dynamic> DefaultEntityRepositoryFactory<T>() where T : class, IObjectState, new()
IRepositoryProvider.cs
IRepositoryAsync<T> GetRepositoryForEntityType<T>() where T : class, IObjectState, new();
Coordinator
Aug 20, 2014 at 5:16 AM
Thanks asbone, will review this with the team, is there a pull request or fork with these changes?
Marked as answer by lelong37 on 9/12/2014 at 3:20 PM