Пример #1
0
 public MongoDbContextModel GetModel(CafMongoDbContext dbContext)
 {
     return(ModelCache.GetOrAdd(
                dbContext.GetType(),
                _ => CreateModel(dbContext)
                ));
 }
Пример #2
0
        private MongoDbContextModel CreateModel(CafMongoDbContext dbContext)
        {
            var modelBuilder = new MongoModelBuilder();

            BuildModelFromDbContextType(modelBuilder, dbContext.GetType());
            BuildModelFromDbContextInstance(modelBuilder, dbContext);
            return(modelBuilder.Build());
        }
Пример #3
0
 protected virtual void BuildModelFromDbContextInstance(MongoModelBuilder modelBuilder, CafMongoDbContext dbContext)
 {
     dbContext.CreateModel(modelBuilder);
 }