public static IDbContext Create(DbContextOption option)
        {
            //if (option.DbContextType != null)
            //{
            //    return (IDbContext)ObjectHelper.CreateInstance(option.DbContextType, new object[] { option.IOMode, option.ConnectionStringName });
            //}
            IDbContextResolver resolver = IoC.Container.Resolve <IDbContextResolver>();

            return(resolver.Resolve(option));
        }
 public BaseQueryRepository(DbContextOption option) : base(option)
 {
     if (option.DbContext == null)
     {
         throw new System.InvalidOperationException("common.context.contextCanNotBeNull");
     }
     if (option.IOMode == IOMode.Read)
     {
         throw new System.InvalidOperationException("common.context.invalidContructorForRead");
     }
     this.DbSet = option.DbContext.GetDbSet <TEntity, ObjectId>();
 }
Example #3
0
 public BaseRepository(DbContextOption option) : this(DbContextFactory.Create(option))
 {
 }
Example #4
0
 public virtual IDbContext Resolve(DbContextOption option)
 {
     throw new NotImplementedException();
 }
Example #5
0
 internal UnitOfWork(DbContextOption option) : this(DbContextFactory.Create(option))
 {
     this.RepositoryType = option.RepositoryType;
 }