当前位置: 首页>>代码示例>>C#>>正文


C# Massive.DynamicRepository类代码示例

本文整理汇总了C#中Massive.DynamicRepository的典型用法代码示例。如果您正苦于以下问题:C# DynamicRepository类的具体用法?C# DynamicRepository怎么用?C# DynamicRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DynamicRepository类属于Massive命名空间,在下文中一共展示了DynamicRepository类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InsertInto

        public static object InsertInto(this object o, string table, ConnectionProfile connectionProfile = null)
        {
            if (connectionProfile == null) connectionProfile = new ConnectionProfile();

            DynamicRepository dynamicModel = new DynamicRepository(connectionProfile, table, "Id");

            return dynamicModel.Insert(o);
        }
开发者ID:kujotx,项目名称:Oak,代码行数:8,代码来源:Query.cs

示例2: Execute

        public DynamicModels Execute(dynamic options,
            DynamicRepository repository,
            string associationName,
            string selectClause,
            IEnumerable<dynamic> models,
            string parentMemberName)
        {
            if (ShouldDiscardCache(options)) Cache = null;

            if (Cache != null) return Cache;

            var many = repository.Query(selectClause).ToList();

            foreach (var item in many)
            {
                var model = models.First(s => s.Id == item.GetMember(parentMemberName));

                item.SetMember(model.GetType().Name, model);
            }

            foreach (var model in models)
            {
                var assocation = model.AssociationNamed(associationName);

                var relatedTo = many.Where(s => s.GetMember(model.GetType().Name).Equals(model)).Select(s => s);

                assocation.EagerLoadMany.Cache = new DynamicModels(relatedTo);

                assocation.AddNewAssociationMethod(assocation.EagerLoadMany.Cache, model);
            }

            return new DynamicModels(many);
        }
开发者ID:eugman,项目名称:Oak,代码行数:33,代码来源:Association.cs

示例3: saving_dynamic_params

        void saving_dynamic_params()
        {
            before = () =>
            {
                seed = new Seed();

                seed.PurgeDb();

                seed.CreateTable("Blogs", new dynamic[]
                {
                    new { Id = "int", Identity = true, PrimaryKey = true },
                    new { Title = "nvarchar(255)" }
                }).ExecuteNonQuery();

                nameValueCollection.Add("Title", "Some Title");
            };

            it["persists saveable values to the database"] = () =>
            {
                var blogs = new DynamicRepository("Blogs");

                var blogId = blogs.Insert(asDynamic);

                var blog = blogs.Single(blogId);

                (blog.Title as string).should_be("Some Title");
            };
        }
开发者ID:pragmaticlogic,项目名称:Oak,代码行数:28,代码来源:describe_ParamsModelBinder.cs

示例4: AddRepository

 public virtual void AddRepository(DynamicModels collection, DynamicRepository repository)
 {
     collection.SetMember("Repository", repository);
 }
开发者ID:eugman,项目名称:Oak,代码行数:4,代码来源:Association.cs

示例5: BelongsTo

        public BelongsTo(DynamicRepository repository)
            : this(repository, null)
        {

        }
开发者ID:eugman,项目名称:Oak,代码行数:5,代码来源:Association.cs

示例6: HasOneThrough

 public HasOneThrough(DynamicRepository repository, DynamicRepository through)
     : this(repository, through, null)
 {
 }
开发者ID:eugman,项目名称:Oak,代码行数:4,代码来源:Association.cs

示例7: HasOne

        public HasOne(DynamicRepository repository)
            : this(repository, null)
        {

        }
开发者ID:eugman,项目名称:Oak,代码行数:5,代码来源:Association.cs

示例8: HasMany

        public HasMany(DynamicRepository repository, string methodName)
        {
            this.Repository = repository;

            this.MethodName = methodName ?? repository.TableName;
        }
开发者ID:eugman,项目名称:Oak,代码行数:6,代码来源:Association.cs

示例9: HasMany

        public HasMany(DynamicRepository repository, string named)
        {
            this.repository = repository;

            this.named = named ?? repository.GetType().Name;
        }
开发者ID:adamjmoon,项目名称:Oak,代码行数:6,代码来源:Association.cs

示例10: BelongsTo

 public BelongsTo(DynamicRepository repository, string named)
 {
     this.Repository = repository;
     Named = named ?? Singular(repository);
 }
开发者ID:amirrajan,项目名称:Demo.Data,代码行数:5,代码来源:Association.cs

示例11: HasOneThrough

 public HasOneThrough(DynamicRepository repository, DynamicRepository through, string named)
 {
     this.Repository = repository;
     this.through = through;
     Named = named ?? Singular(Repository);
 }
开发者ID:amirrajan,项目名称:Demo.Data,代码行数:6,代码来源:Association.cs

示例12: HasOne

        public HasOne(DynamicRepository repository, string named)
        {
            this.Repository = repository;

            Named = named ?? Singular(Repository);
        }
开发者ID:amirrajan,项目名称:Demo.Data,代码行数:6,代码来源:Association.cs

示例13: RepositoryFor

        public static DynamicRepository RepositoryFor(string tableName)
        {
            var repo = new DynamicRepository(tableName);

            AssociationByConventions.ApplyProjection(repo);

            return repo;
        }
开发者ID:pgermishuys,项目名称:Oak,代码行数:8,代码来源:Association.cs

示例14: HasManyThrough

        public HasManyThrough(DynamicRepository repository, DynamicRepository through, string methodName)
        {
            this.Repository = repository;

            this.through = through;

            this.throughTable = through.TableName;

            this.MethodName = methodName ?? repository.TableName;
        }
开发者ID:eugman,项目名称:Oak,代码行数:10,代码来源:Association.cs

示例15: HasManyThrough

        public HasManyThrough(DynamicRepository repository, DynamicRepository through, string named)
        {
            this.repository = repository;

            this.through = through;

            this.named = named ?? repository.GetType().Name;
        }
开发者ID:adamjmoon,项目名称:Oak,代码行数:8,代码来源:Association.cs


注:本文中的Massive.DynamicRepository类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。