コード例 #1
0
 public IRepository <TModel, TQueryBuilder> CreateRepository <TModel, TQueryBuilder>(RepositoryConfiguration config, params Assembly[] assemblies)
     where TQueryBuilder : class, IQueryBuilder <TModel>
     where TModel : class
 {
     return(this.CreateRepository <TModel, TQueryBuilder>(
                config,
                assemblies.SelectMany(i => i.GetTypes()).ToArray()));
 }
コード例 #2
0
        public IRepository <TModel, TQueryBuilder> CreateRepository <TModel, TQueryBuilder>(RepositoryConfiguration config, params Type[] types)
            where TQueryBuilder : class, IQueryBuilder <TModel>
            where TModel : class
        {
            var server     = MongoServer.Create(config.ConnectionString);
            var database   = server.GetDatabase(config.DatabaseName);
            var collection = database.GetCollection(config.CollectionName);

            return(new StandardRepository <TModel, TQueryBuilder>
            {
                Collection = collection,
                Config = config,
                QueryBuildery = new QueryBuildery(new MethodConventionParser(types))
            });
        }