Exemplo n.º 1
0
 /// <summary>
 /// Initialize an instance of <see cref="DynamicProxyGenerator"/>.
 /// </summary>
 /// <param name="typeRepo">The type repository.</param>
 /// <param name="dynamicProxyStub">The dynamic proxy stub.</param>
 /// <param name="dbClient">The database client.</param>
 /// <param name="isReadonly">True if the proxy from the getter is readonly.</param>
 public DynamicProxyGenerator(
     TypeRepository typeRepo,
     DynamicProxyStub dynamicProxyStub,
     IDatabase dbClient,
     bool isReadonly = false)
 {
     this.typeRepo         = typeRepo;
     this.dynamicProxyStub = dynamicProxyStub;
     this.dbClient         = dbClient;
     this.Readonly         = isReadonly;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Create an instance of <see cref="DbContext"/>.
        /// </summary>
        /// <param name="dbClient">The Redis database provider.</param>
        /// <returns>The database context.</returns>
        public IDbContext Create(IDatabase database)
        {
            var typeRepo = this.CreateTypeRepo();

            var dbRecordBuilder = new DbRecordBuilder(typeRepo);

            var proxyStub      = new DynamicProxyStub(typeRepo, database, dbRecordBuilder);
            var proxyGenerator = new DynamicProxyGenerator(typeRepo, proxyStub, database);

            return(new DbContext(typeRepo, dbRecordBuilder, proxyGenerator, database));
        }