• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Common.MappingEntity类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GetDeleteExpression

        public override Expression GetDeleteExpression(MappingEntity entity, Expression instance, LambdaExpression deleteCheck)
        {
            var tables = this.mapping.GetTables(entity);
            if (tables.Count < 2)
            {
                return base.GetDeleteExpression(entity, instance, deleteCheck);
            }

            var commands = new List<Expression>();
            foreach (var table in this.GetDependencyOrderedTables(entity).Reverse())
            {
                TableExpression tex = new TableExpression(new TableAlias(), entity, this.mapping.GetTableName(table));
                var where = this.GetIdentityCheck(tex, entity, instance);
                commands.Add(new DeleteCommand(tex, where));
            }

            Expression block = new BlockCommand(commands);

            if (deleteCheck != null)
            {
                var test = this.GetEntityStateTest(entity, instance, deleteCheck);
                return new IFCommand(test, block, null);
            }

            return block;
        }
开发者ID:rdrawsky,项目名称:iqtoolkit,代码行数:26,代码来源:AdvancedMapping.cs


示例2: GetEntityExpression

        public override EntityExpression GetEntityExpression(Expression root, MappingEntity entity)
        {
            // must be some complex type constructed from multiple columns
            var assignments = new List<EntityAssignment>();
            foreach (MemberInfo mi in this.mapping.GetMappedMembers(entity))
            {
                if (!this.mapping.IsAssociationRelationship(entity, mi))
                {
                    Expression me;
                    if (this.mapping.IsNestedEntity(entity, mi))
                    {
                        me = this.GetEntityExpression(root, this.mapping.GetRelatedEntity(entity, mi));
                    }
                    else
                    {
                        me = this.GetMemberExpression(root, entity, mi);
                    }
                    if (me != null)
                    {
                        assignments.Add(new EntityAssignment(mi, me));
                    }
                }
            }

            return new EntityExpression(entity, this.BuildEntityExpression(entity, assignments));
        }
开发者ID:rdrawsky,项目名称:iqtoolkit,代码行数:26,代码来源:AdvancedMapping.cs


示例3: GetDependencyOrderedTables

 public virtual IEnumerable<MappingTable> GetDependencyOrderedTables(MappingEntity entity)
 {
     var lookup = _mapping.GetTables(entity).ToLookup(t => _mapping.GetAlias(t));
     return
         _mapping.GetTables(entity).Sort(
             t => _mapping.IsExtensionTable(t) ? lookup[_mapping.GetExtensionRelatedAlias(t)] : null);
 }
开发者ID:firestrand,项目名称:IQToolkit,代码行数:7,代码来源:AdvancedMapping.cs


示例4: GetColumnName

        public override string GetColumnName(MappingEntity entity, MemberInfo member)
        {
            var dbMapping = (DbMappingEntity) entity;
            var memberMapping = dbMapping.TypeMapping.GetMember(member.Name);
            if (memberMapping == null)
                return null;

            return memberMapping.ColumnName;
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:9,代码来源:DeveelDbMapping.cs


示例5: GetColumnType

 /// <summary>
 /// The query language specific type for the column
 /// </summary>
 /// <param name="member"></param>
 /// <returns></returns>
 public virtual QueryType GetColumnType(MappingEntity entity, MemberInfo member)
 {
     string dbType = this.mapping.GetColumnDbType(entity, member);
     if (dbType != null)
     {
         return this.translator.Linguist.Language.TypeSystem.Parse(dbType);
     }
     return this.translator.Linguist.Language.TypeSystem.GetColumnType(TypeHelper.GetMemberType(member));
 }
开发者ID:firestrand,项目名称:IQToolkit,代码行数:14,代码来源:BasicMapper.cs


示例6: GetColumnDbType

        public override string GetColumnDbType(MappingEntity entity, MemberInfo member)
        {
            var dbMapping = (DbMappingEntity)entity;
            var mapppedMember = dbMapping.TypeMapping.GetMember(member.Name);
            if (mapppedMember == null)
                return null;

            // TODO: Check if here we should provide the full version of the type of just the name
            return mapppedMember.ColumnType.TypeCode.ToString();
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:10,代码来源:DeveelDbMapping.cs


示例7: GetMappedMembers

 public override IEnumerable<MemberInfo> GetMappedMembers(MappingEntity entity)
 {
     DbTableEntityMapping tm = ((SimpleMappingEntity)entity).TableTypeMapping;
     foreach (DbFieldMemberInfo mi in tm.DbFieldMemberInfos.Values)
     {
         yield return mi.Member;
     }
     foreach (AssociationInfo ai in tm.AssociationInfos.Values)
     {
         yield return ai.Member;
     }
 }
开发者ID:lepigocher,项目名称:simple-database,代码行数:12,代码来源:SimpleMapping.cs


示例8: CloneEntity

 public override object CloneEntity(MappingEntity entity, object instance)
 {
     var clone = System.Runtime.Serialization.FormatterServices.GetUninitializedObject(entity.EntityType);
     foreach (var mi in this.GetMappedMembers(entity))
     {
         if (this.IsColumn(entity, mi))
         {
             mi.SetValue(clone, mi.GetValue(instance));
         }
     }
     return clone;
 }
开发者ID:firestrand,项目名称:IQToolkit,代码行数:12,代码来源:BasicMapping.cs


示例9: FindDbField

        public DbField FindDbField(MappingEntity entity, MemberInfo member)
        {
            DbTableEntityMapping tm = ((SimpleMappingEntity)entity).TableTypeMapping;

            string pName;
            if (entity.EntityType.Equals(member.ReflectedType))
                pName = member.Name;
            else
                pName = DbTableEntityMapping.GetFullMemberName(member.DeclaringType.Name, member.Name);

            if (tm.DbFieldInfos.ContainsKey(pName))
                return tm.DbFieldInfos[pName];
            return null;
        }
开发者ID:lepigocher,项目名称:simple-database,代码行数:14,代码来源:SimpleMapping.cs


示例10: GetDeleteExpression

        public override Expression GetDeleteExpression(MappingEntity entity, Expression instance, LambdaExpression deleteCheck)
        {
            TableExpression table = new TableExpression(new TableAlias(), entity, this.mapping.GetTableName(entity));
            Expression where = null;

            if (instance != null)
            {
                where = this.GetIdentityCheck(table, entity, instance);
            }

            if (deleteCheck != null)
            {
                Expression row = this.GetEntityExpression(table, entity);
                Expression pred = DbExpressionReplacer.Replace(deleteCheck.Body, deleteCheck.Parameters[0], row);
                where = (where != null) ? where.And(pred) : pred;
            }

            return new DeleteCommand(table, where);
        }
开发者ID:firestrand,项目名称:IQToolkit,代码行数:19,代码来源:BasicMapper.cs


示例11: IsNestedEntity

 public abstract bool IsNestedEntity(MappingEntity entity, MemberInfo member);
开发者ID:rdrawsky,项目名称:iqtoolkit,代码行数:1,代码来源:AdvancedMapping.cs


示例12: GetTables

 public abstract IList<MappingTable> GetTables(MappingEntity entity);
开发者ID:rdrawsky,项目名称:iqtoolkit,代码行数:1,代码来源:AdvancedMapping.cs


示例13: GetAlias

 public abstract string GetAlias(MappingEntity entity, MemberInfo member);
开发者ID:rdrawsky,项目名称:iqtoolkit,代码行数:1,代码来源:AdvancedMapping.cs


示例14: GetRelatedColumnAssignments

 private IEnumerable<ColumnAssignment> GetRelatedColumnAssignments(Expression expr, MappingEntity entity, MappingTable table, Dictionary<MemberInfo, Expression> map)
 {
     if (this.mapping.IsExtensionTable(table))
     {
         var keyColumns = this.mapping.GetExtensionKeyColumnNames(table).ToArray();
         var relatedMembers = this.mapping.GetExtensionRelatedMembers(table).ToArray();
         for (int i = 0, n = keyColumns.Length; i < n; i++)
         {
             MemberInfo member = relatedMembers[i];
             Expression exp = map[member];
             yield return new ColumnAssignment((ColumnExpression)this.GetMemberExpression(expr, entity, member), exp);
         }
     }
 }
开发者ID:rdrawsky,项目名称:iqtoolkit,代码行数:14,代码来源:AdvancedMapping.cs


示例15: GetIdentityCheck

        private Expression GetIdentityCheck(TableExpression root, MappingEntity entity, Expression instance, MappingTable table)
        {
            if (this.mapping.IsExtensionTable(table))
            {
                var keyColNames = this.mapping.GetExtensionKeyColumnNames(table).ToArray();
                var relatedMembers = this.mapping.GetExtensionRelatedMembers(table).ToArray();

                Expression where = null;
                for (int i = 0, n = keyColNames.Length; i < n; i++)
                {
                    var relatedMember = relatedMembers[i];
                    var cex = new ColumnExpression(TypeHelper.GetMemberType(relatedMember), this.GetColumnType(entity, relatedMember), root.Alias, keyColNames[n]);
                    var nex = this.GetMemberExpression(instance, entity, relatedMember);
                    var eq = cex.Equal(nex);
                    where = (where != null) ? where.And(eq) : where;
                }
                return where;
            }
            else
            {
                return base.GetIdentityCheck(root, entity, instance);
            }
        }
开发者ID:rdrawsky,项目名称:iqtoolkit,代码行数:23,代码来源:AdvancedMapping.cs


示例16: GetColumnDbType

 /// <summary>
 /// The type declaration for the column in the provider's syntax
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="member"></param>
 /// <returns>a string representing the type declaration or null</returns>
 public virtual string GetColumnDbType(MappingEntity entity, MemberInfo member)
 {
     return null;
 }
开发者ID:jeswin,项目名称:AgileFx,代码行数:10,代码来源:BasicMapping.cs


示例17: GetDependentGeneratedColumns

 private Dictionary<string, List<MemberInfo>> GetDependentGeneratedColumns(MappingEntity entity)
 {
     return
         (from xt in this.mapping.GetTables(entity).Where(t => this.mapping.IsExtensionTable(t))
          group xt by this.mapping.GetExtensionRelatedAlias(xt))
         .ToDictionary(
             g => g.Key,
             g => g.SelectMany(xt => this.mapping.GetExtensionRelatedMembers(xt)).Distinct().ToList()
         );
 }
开发者ID:rdrawsky,项目名称:iqtoolkit,代码行数:10,代码来源:AdvancedMapping.cs


示例18: GetColumns

 private void GetColumns(MappingEntity entity, Dictionary<string, TableAlias> aliases, List<ColumnDeclaration> columns)
 {
     foreach (MemberInfo mi in this.mapping.GetMappedMembers(entity))
     {
         if (!this.mapping.IsAssociationRelationship(entity, mi))
         {
             if (this.mapping.IsNestedEntity(entity, mi))
             {
                 this.GetColumns(this.mapping.GetRelatedEntity(entity, mi), aliases, columns);
             }
             else if (this.mapping.IsColumn(entity, mi))
             {
                 string name = this.mapping.GetColumnName(entity, mi);
                 string aliasName = this.mapping.GetAlias(entity, mi);
                 TableAlias alias;
                 aliases.TryGetValue(aliasName, out alias);
                 var colType = this.GetColumnType(entity, mi);
                 ColumnExpression ce = new ColumnExpression(TypeHelper.GetMemberType(mi), colType, alias, name);
                 ColumnDeclaration cd = new ColumnDeclaration(name, ce, colType);
                 columns.Add(cd);
             }
         }
     }
 }
开发者ID:rdrawsky,项目名称:iqtoolkit,代码行数:24,代码来源:AdvancedMapping.cs


示例19: GetColumnAssignments

 private IEnumerable<ColumnAssignment> GetColumnAssignments(
     Expression table, Expression instance, MappingEntity entity,
     Func<MappingEntity, MemberInfo, bool> fnIncludeColumn,
     Dictionary<MemberInfo, Expression> map)
 {
     foreach (var m in this.mapping.GetMappedMembers(entity))
     {
         if (this.mapping.IsColumn(entity, m) && fnIncludeColumn(entity, m))
         {
             yield return new ColumnAssignment(
                 (ColumnExpression)this.GetMemberExpression(table, entity, m),
                 this.GetMemberAccess(instance, m, map)
                 );
         }
         else if (this.mapping.IsNestedEntity(entity, m))
         {
             var assignments = this.GetColumnAssignments(
                 table,
                 Expression.MakeMemberAccess(instance, m),
                 this.mapping.GetRelatedEntity(entity, m),
                 fnIncludeColumn,
                 map
                 );
             foreach (var ca in assignments)
             {
                 yield return ca;
             }
         }
     }
 }
开发者ID:rdrawsky,项目名称:iqtoolkit,代码行数:30,代码来源:AdvancedMapping.cs


示例20: GetInsertExpression

        public override Expression GetInsertExpression(MappingEntity entity, Expression instance, LambdaExpression selector)
        {
            var tables = this.mapping.GetTables(entity);
            if (tables.Count < 2)
            {
                return base.GetInsertExpression(entity, instance, selector);
            }

            var commands = new List<Expression>();

            var map = this.GetDependentGeneratedColumns(entity);
            var vexMap = new Dictionary<MemberInfo, Expression>();

            foreach (var table in this.GetDependencyOrderedTables(entity))
            {
                var tableAlias = new TableAlias();
                var tex = new TableExpression(tableAlias, entity, this.mapping.GetTableName(table));
                var assignments = this.GetColumnAssignments(tex, instance, entity,
                    (e, m) => this.mapping.GetAlias(e, m) == this.mapping.GetAlias(table) && !this.mapping.IsGenerated(e, m),
                    vexMap
                    );
                var totalAssignments = assignments.Concat(
                    this.GetRelatedColumnAssignments(tex, entity, table, vexMap)
                    );
                commands.Add(new InsertCommand(tex, totalAssignments));

                List<MemberInfo> members;
                if (map.TryGetValue(this.mapping.GetAlias(table), out members))
                {
                    var d = this.GetDependentGeneratedVariableDeclaration(entity, table, members, instance, vexMap);
                    commands.Add(d);
                }
            }

            if (selector != null)
            {
                commands.Add(this.GetInsertResult(entity, instance, selector, vexMap));
            }

            return new BlockCommand(commands);
        }
开发者ID:rdrawsky,项目名称:iqtoolkit,代码行数:41,代码来源:AdvancedMapping.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# WebServiceInterfaces.CollectionRequest类代码示例发布时间:2022-05-26
下一篇:
C# IPTV2_Model.IPTV2Entities类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap