private static void FillSqlClauseBuilder <T>(
            SqlClauseBuilderIUW builder,
            T graph,
            ORMappingItemCollection mapping,
            ClauseBindingFlags bindingFlags,
            DoSqlClauseBuilder <T> builderDelegate,
            params string[] ignorProperties)
        {
            ExceptionHelper.FalseThrow <ArgumentNullException>(graph != null, "graph");

            foreach (ORMappingItem item in mapping)
            {
                if (Array.Exists <string>(ignorProperties,
                                          delegate(string target)
                {
                    return(string.Compare(target, item.PropertyName, true) == 0);
                }) == false)
                {
                    if ((item.BindingFlags & bindingFlags) != ClauseBindingFlags.None)
                    {
                        builderDelegate(builder, item, graph);
                    }
                }
            }
        }
示例#2
0
        /// <summary>
        /// 从XmlReader中设置属性
        /// </summary>
        /// <param name="reader">Xml阅读器</param>
        /// <param name="dType">DeclaringType</param>
        /// <param name="mi">成员属性</param>
        public void ReadFromXml(XmlReader reader, System.Type dType, MemberInfo mi)
        {
            this.memberInfo    = mi;
            this.declaringType = dType;

            this.propertyName  = XmlHelper.GetAttributeValue(reader, "propertyName", this.propertyName);
            this.dataFieldName = XmlHelper.GetAttributeValue(reader, "dataFieldName", this.dataFieldName);
            this.format        = XmlHelper.GetAttributeValue(reader, "format", this.format);

            this.isIdentity = XmlHelper.GetAttributeValue(reader, "isIdentity", this.isIdentity);
            this.primaryKey = XmlHelper.GetAttributeValue(reader, "primaryKey", this.primaryKey);
            this.length     = XmlHelper.GetAttributeValue(reader, "length", this.length);

            this.isNullable   = XmlHelper.GetAttributeValue(reader, "isNullable", this.isNullable);
            this.bindingFlags = XmlHelper.GetAttributeValue(reader, "bindingFlags", this.bindingFlags);

            this.defaultExpression = XmlHelper.GetAttributeValue(reader, "defaultExpression", this.defaultExpression);

            this.enumUsage               = XmlHelper.GetAttributeValue(reader, "enumUsage", this.enumUsage);
            this.subClassPropertyName    = XmlHelper.GetAttributeValue(reader, "subClassPropertyName", this.subClassPropertyName);
            this.subClassTypeDescription = XmlHelper.GetAttributeValue(reader, "subClassTypeDescription", this.subClassTypeDescription);

            this.encryptProperty = XmlHelper.GetAttributeValue(reader, "encryptProperty", false);
            this.encryptorName   = XmlHelper.GetAttributeValue(reader, "encryptorName", (string)null);
        }
示例#3
0
        private static void FillSqlClauseBuilder <T>(
            SqlClauseBuilderIUW builder,
            T graph,
            ORMappingItemCollection mapping,
            ClauseBindingFlags bindingFlags,
            DoSqlClauseBuilder <T> builderDelegate,
            params string[] ignoreProperties)
        {
            ExceptionHelper.FalseThrow <ArgumentNullException>(graph != null, "graph");

            using (ORMappingContext context = ORMappingContext.GetContext())
            {
                foreach (ORMappingItem item in mapping)
                {
                    if (Array.Exists <string>(ignoreProperties, target => (string.Compare(target, item.PropertyName, true) == 0)
                                              ) == false)
                    {
                        if ((item.BindingFlags & bindingFlags) != ClauseBindingFlags.None)
                        {
                            builderDelegate(builder, item, graph);
                        }
                    }
                }
            }

            builder.AppendTenantCode(typeof(T));
        }
示例#4
0
 private static void FillSqlClauseBuilder(SelectSqlClauseBuilder builder, DataModel mapping,
                                          ClauseBindingFlags bindingFlags, DoSelectClauseBuilder builderDelegate, params string[] ignorProperties)
 {
     mapping.Properties.ForEach(property =>
     {
         if (!ignorProperties.Contains(property.Name))
         {
             if (property.OutputMapping)
             {
                 builderDelegate(builder, property);
             }
         }
     });
 }
示例#5
0
        private static void FillSqlClauseBuilder <T>(SqlClauseBuilderIUW builder, T graph, DataModel mapping,
                                                     ClauseBindingFlags bindingFlags, DoSqlClauseBuilder <T> builderDelegate, string[] ignorProperties)
        {
            ExceptionHelper.FalseThrow <ArgumentNullException>(graph != null, "graph");

            mapping.Properties.ForEach(property =>
            {
                if (!ignorProperties.Contains(property.Name))
                {
                    if (property.InputMapping)
                    {
                        builderDelegate(builder, property, graph);
                    }
                }
            });
        }
 private static void FillSqlClauseBuilder(SelectSqlClauseBuilder builder, ORMappingItemCollection mapping,
                                          ClauseBindingFlags bindingFlags, DoSelectClauseBuilder builderDelegate, params string[] ignorProperties)
 {
     foreach (ORMappingItem item in mapping)
     {
         if (Array.Exists <string>(ignorProperties,
                                   delegate(string target)
         {
             return(string.Compare(target, item.PropertyName, true) == 0);
         }) == false)
         {
             if ((item.BindingFlags & bindingFlags) != ClauseBindingFlags.None)
             {
                 builderDelegate(builder, item);
             }
         }
     }
 }
示例#7
0
        /// <summary>
        /// 从XmlReader中设置属性
        /// </summary>
        /// <param name="reader">Xml阅读器</param>
        /// <param name="mi">成员属性</param>
        public void ReadFromXml(XmlReader reader, MemberInfo mi)
        {
            this.memberInfo = mi;

            this.propertyName  = XmlHelper.GetAttributeValue(reader, "propertyName", this.propertyName);
            this.dataFieldName = XmlHelper.GetAttributeValue(reader, "dataFieldName", this.dataFieldName);

            this.isIdentity = XmlHelper.GetAttributeValue(reader, "isIdentity", this.isIdentity);
            this.primaryKey = XmlHelper.GetAttributeValue(reader, "primaryKey", this.primaryKey);
            this.length     = XmlHelper.GetAttributeValue(reader, "length", this.length);

            this.isNullable   = XmlHelper.GetAttributeValue(reader, "isNullable", this.isNullable);
            this.bindingFlags = XmlHelper.GetAttributeValue(reader, "bindingFlags", this.bindingFlags);

            this.defaultExpression = XmlHelper.GetAttributeValue(reader, "defaultExpression", this.defaultExpression);

            this.enumUsage               = XmlHelper.GetAttributeValue(reader, "enumUsage", this.enumUsage);
            this.subClassPropertyName    = XmlHelper.GetAttributeValue(reader, "subClassPropertyName", this.subClassPropertyName);
            this.subClassTypeDescription = XmlHelper.GetAttributeValue(reader, "subClassTypeDescription", this.subClassTypeDescription);
        }
示例#8
0
 /// <summary>
 /// 构造方法
 /// </summary>
 /// <param name="flags">对应的属性值会出现在哪些Sql语句中</param>
 /// <param name="defaultExpression">如果对应的属性值为空,使用的缺省值表达式</param>
 public SqlBehaviorAttribute(ClauseBindingFlags flags, string defaultExpression) : this(flags)
 {
     this.defaultExpression = defaultExpression;
 }
示例#9
0
 /// <summary>
 /// 构造方法
 /// </summary>
 /// <param name="flags">对应的属性值会出现在哪些Sql语句中</param>
 public SqlBehaviorAttribute(ClauseBindingFlags flags)
 {
     this.bindingFlags = flags;
 }
 /// <summary>
 /// 构造方法
 /// </summary>
 /// <param name="flags">对应的属性值会出现在哪些Sql语句中</param>
 /// <param name="defaultExpression">如果对应的属性值为空,使用的缺省值表达式</param>
 public SqlBehaviorAttribute(ClauseBindingFlags flags, string defaultExpression) : this(flags)
 {
     this.defaultExpression = defaultExpression;
 }
 /// <summary>
 /// 构造方法
 /// </summary>
 /// <param name="flags">对应的属性值会出现在哪些Sql语句中</param>
 public SqlBehaviorAttribute(ClauseBindingFlags flags)
 {
     this.bindingFlags = flags;
 }
示例#12
0
 /// <summary>
 /// 构造方法
 /// </summary>
 /// <param name="subPropertyName"></param>
 /// <param name="flags">对应的属性值会出现在哪些Sql语句中</param>
 /// <param name="defaultExpression">如果对应的属性值为空,使用的缺省值表达式</param>
 public SubClassSqlBehaviorAttribute(string subPropertyName, ClauseBindingFlags flags, string defaultExpression)
     : base(flags, defaultExpression)
 {
     this.subPropertyName = subPropertyName;
 }
示例#13
0
 /// <summary>
 /// 构造方法
 /// </summary>
 /// <param name="subPropertyName"></param>
 /// <param name="flags">对应的属性值会出现在哪些Sql语句中</param>
 public SubClassSqlBehaviorAttribute(string subPropertyName, ClauseBindingFlags flags)
     : base(flags)
 {
     this.subPropertyName = subPropertyName;
 }
 /// <summary>
 /// 构造方法
 /// </summary>
 /// <param name="subPropertyName"></param>
 /// <param name="flags">对应的属性值会出现在哪些Sql语句中</param>
 /// <param name="defaultExpression">如果对应的属性值为空,使用的缺省值表达式</param>
 public SubClassSqlBehaviorAttribute(string subPropertyName, ClauseBindingFlags flags, string defaultExpression)
     : base(flags, defaultExpression)
 {
     this.subPropertyName = subPropertyName;
 }
 /// <summary>
 /// 构造方法
 /// </summary>
 /// <param name="subPropertyName"></param>
 /// <param name="flags">对应的属性值会出现在哪些Sql语句中</param>
 public SubClassSqlBehaviorAttribute(string subPropertyName, ClauseBindingFlags flags)
     : base(flags)
 {
     this.subPropertyName = subPropertyName;
 }
示例#16
0
		/// <summary>
		/// 从XmlReader中设置属性
		/// </summary>
		/// <param name="reader">Xml阅读器</param>
		/// <param name="dType">DeclaringType</param>
		/// <param name="mi">成员属性</param>
		public void ReadFromXml(XmlReader reader, System.Type dType, MemberInfo mi)
		{
			this.memberInfo = mi;
			this.declaringType = dType;

			this.propertyName = XmlHelper.GetAttributeValue(reader, "propertyName", this.propertyName);
			this.dataFieldName = XmlHelper.GetAttributeValue(reader, "dataFieldName", this.dataFieldName);
			this.format = XmlHelper.GetAttributeValue(reader, "format", this.format);

			this.isIdentity = XmlHelper.GetAttributeValue(reader, "isIdentity", this.isIdentity);
			this.primaryKey = XmlHelper.GetAttributeValue(reader, "primaryKey", this.primaryKey);
			this.length = XmlHelper.GetAttributeValue(reader, "length", this.length);

			this.isNullable = XmlHelper.GetAttributeValue(reader, "isNullable", this.isNullable);
			this.bindingFlags = XmlHelper.GetAttributeValue(reader, "bindingFlags", this.bindingFlags);

			this.defaultExpression = XmlHelper.GetAttributeValue(reader, "defaultExpression", this.defaultExpression);

			this.enumUsage = XmlHelper.GetAttributeValue(reader, "enumUsage", this.enumUsage);
			this.subClassPropertyName = XmlHelper.GetAttributeValue(reader, "subClassPropertyName", this.subClassPropertyName);
			this.subClassTypeDescription = XmlHelper.GetAttributeValue(reader, "subClassTypeDescription", this.subClassTypeDescription);

			this.encryptProperty = XmlHelper.GetAttributeValue(reader, "encryptProperty", false);
			this.encryptorName = XmlHelper.GetAttributeValue(reader, "encryptorName", (string)null);
		}