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


C# IPropertyMap.GetAdditionalColumnMaps方法代码示例

本文整理汇总了C#中IPropertyMap.GetAdditionalColumnMaps方法的典型用法代码示例。如果您正苦于以下问题:C# IPropertyMap.GetAdditionalColumnMaps方法的具体用法?C# IPropertyMap.GetAdditionalColumnMaps怎么用?C# IPropertyMap.GetAdditionalColumnMaps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPropertyMap的用法示例。


在下文中一共展示了IPropertyMap.GetAdditionalColumnMaps方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetSelectSingleReferencePropertyStatement


//.........这里部分代码省略.........

			IObjectManager om;
			foreach (IPropertyMap iRefPropertyMap in classMap.GetPrimaryPropertyMaps())
			{
				refPropertyMap = iRefPropertyMap;
				if (!(propertyMap.LazyLoad))
				{
					if (!((refPropertyMap.IsCollection || (refPropertyMap.ReferenceType != ReferenceType.None && !(refPropertyMap.IsIdentity)))))
					{
						IColumnMap refColumnMap = refPropertyMap.GetColumnMap();
						SqlColumnAlias refColumn = forTable.GetSqlColumnAlias(refColumnMap);
						colName = refColumnMap.Name;
						if (refPropertyMap.IsIdentity)
							idColumns.Add(colName);

						if (!(refPropertyMap.LazyLoad))
						{
							select.SqlSelectClause.AddSqlAliasSelectListItem(refColumn);
							hashPropertyColumnMap[refPropertyMap.Name] = colName;
						}
					}
				}
			}
			typeColumnMap = classMap.GetTypeColumnMap();
			if (typeColumnMap != null)
			{
				SqlColumnAlias typeColumn = forTable.GetSqlColumnAlias(typeColumnMap);
				typeColumns.Add(typeColumnMap.Name);
				select.SqlSelectClause.AddSqlAliasSelectListItem(typeColumn);
			}
			select.SqlFromClause.AddSqlAliasTableSource(table);
			SqlTableAlias selfTable ;

			//if (tableMap.SourceMap.Schema.ToLower(CultureInfo.InvariantCulture) == forTableMap.SourceMap.Schema.ToLower(CultureInfo.InvariantCulture) && tableMap.Name.ToLower(CultureInfo.InvariantCulture) == forTableMap.Name.ToLower(CultureInfo.InvariantCulture))
			if (tableMap == forTableMap)
			{
				selfTable = select.GetSqlTableAlias(tableMap, "NPersistSelfRefTable");
				select.SqlFromClause.AddSqlAliasTableSource(selfTable);				
			}
			else
			{
				selfTable = select.GetSqlTableAlias(tableMap);				
				select.SqlFromClause.AddSqlAliasTableSource(forTable);				
			}


			theColumn = selfTable.GetSqlColumnAlias(theColumnMap);

			SqlSearchCondition search = select.SqlWhereClause.GetNextSqlSearchCondition()  ;
			search.GetSqlComparePredicate(theColumn, SqlCompareOperatorType.Equals, forColumn);

			foreach (IColumnMap iAddColumnMap in propertyMap.GetAdditionalColumnMaps())
			{
				addColumnMap = iAddColumnMap;
				addForTableMap = addColumnMap.GetPrimaryKeyTableMap();
				addForColumnMap = addColumnMap.MustGetPrimaryKeyColumnMap();
				if (addForTableMap == null)
					throw new MappingException("TableMap '" + addColumnMap.PrimaryKeyTable + "' Not Found!"); // do not localize
				if (addForColumnMap == null)
					throw new MappingException("ColumnMap '" + addColumnMap.PrimaryKeyColumn + "' Not Found!"); // do not localize

				SqlColumnAlias addColumn = selfTable.GetSqlColumnAlias(addColumnMap);
				SqlColumnAlias addForColumn = forTable.GetSqlColumnAlias(addForColumnMap);

				search = select.SqlWhereClause.GetNextSqlSearchCondition()  ;
				search.GetSqlComparePredicate(addColumn, SqlCompareOperatorType.Equals, addForColumn);
			}

			om = m_SqlEngineManager.Context.ObjectManager;
			foreach (IPropertyMap iMyPropertyMap in propertyMap.ClassMap.GetIdentityPropertyMaps())
			{
				myPropertyMap = iMyPropertyMap;
				columnMap = myPropertyMap.GetColumnMap();

				SqlColumnAlias column = selfTable.GetSqlColumnAlias(columnMap);
				SqlParameter param;

				paramName = GetParameterName(myPropertyMap, "Id_");
				if (om.GetPropertyStatus(obj, propertyMap.Name) == PropertyStatus.Dirty)
					param = AddSqlParameter(select, parameters, paramName, obj, myPropertyMap, om.GetOriginalPropertyValue(obj, myPropertyMap.Name), columnMap, true);
				else
					param = AddSqlParameter(select, parameters, paramName, obj, myPropertyMap, om.GetPropertyValue(obj, myPropertyMap.Name), columnMap);

				search = select.SqlWhereClause.GetNextSqlSearchCondition()  ;
				search.GetSqlComparePredicate(column, SqlCompareOperatorType.Equals, param);
			}
			typeColumnMap = propertyMap.ClassMap.GetTypeColumnMap();
			if (typeColumnMap != null)
			{
				domainMap = propertyMap.ClassMap.DomainMap;
				SqlColumnAlias typeColumn = selfTable.GetSqlColumnAlias(typeColumnMap);
				
				paramName = GetParameterName(propertyMap.ClassMap, "Type_");
				SqlParameter param = AddSqlParameter(select, parameters, paramName, obj, null, domainMap.MustGetClassMap(obj.GetType()).TypeValue, typeColumnMap, true);

				search = select.SqlWhereClause.GetNextSqlSearchCondition()  ;
				search.GetSqlComparePredicate(typeColumn, SqlCompareOperatorType.Equals, param);
			}
			return GenerateSql(select);
		}
开发者ID:Dawn-of-Light,项目名称:Puzzle.NET,代码行数:101,代码来源:SqlEngineBase.cs

示例2: GetSelectManyManyPropertyStatement


//.........这里部分代码省略.........
					SqlColumnAlias refColumn = select.GetSqlColumnAlias(refColumnMap);
					colName = refColumnMap.Name;
					if (refPropertyMap.IsIdentity)
						idColumns.Add(colName);

					if (!(refPropertyMap.LazyLoad))
					{
						select.SqlSelectClause.AddSqlAliasSelectListItem(refColumn);

						hashPropertyColumnMap[refPropertyMap.Name] = colName;
						if (refPropertyMap == orderByMap)
							select.SqlOrderByClause.AddSqlOrderByItem(refColumn);
					}
				}
			}
			typeColumnMap = classMap.GetTypeColumnMap();
			if (typeColumnMap != null)
			{
				typeColumns.Add(typeColumnMap.Name);
				SqlColumnAlias typeColumn = select.GetSqlColumnAlias(typeColumnMap);
				select.SqlSelectClause.AddSqlAliasSelectListItem(typeColumn);
			}
			select.SqlFromClause.AddSqlAliasTableSource(table);
			select.SqlFromClause.AddSqlAliasTableSource(joinTable);

			//if (tableMap.SourceMap.Schema.ToLower(CultureInfo.InvariantCulture) == myTableMap.SourceMap.Schema.ToLower(CultureInfo.InvariantCulture) && tableMap.Name.ToLower(CultureInfo.InvariantCulture) == myTableMap.Name.ToLower(CultureInfo.InvariantCulture))
			if (tableMap == myTableMap)
				myTable = select.GetSqlTableAlias(myTableMap, "NPersistSelfRefTable");
			else
				myTable = select.GetSqlTableAlias(myTableMap);

			SqlColumnAlias myColumn = myTable.GetSqlColumnAlias(myColumnMap);

			select.SqlFromClause.AddSqlAliasTableSource(myTable);

			SqlSearchCondition search = select.SqlWhereClause.GetNextSqlSearchCondition();
			search.GetSqlComparePredicate(forColumn, SqlCompareOperatorType.Equals,  colColumn);

			foreach (IColumnMap iAddColumnMap in propertyMap.GetAdditionalColumnMaps())
			{
				addColumnMap = iAddColumnMap;
				addMyColumnMap = addColumnMap.MustGetPrimaryKeyColumnMap();
				if (addMyColumnMap == null)
					throw new MappingException("ColumnMap '" + addColumnMap.PrimaryKeyColumn + "' Not Found!"); // do not localize

				SqlColumnAlias addColumn = forTable.GetSqlColumnAlias(addColumnMap);
				SqlColumnAlias addMyColumn = joinTable.GetSqlColumnAlias(addMyColumnMap);

				search = select.SqlWhereClause.GetNextSqlSearchCondition();
				search.GetSqlComparePredicate(addColumn, SqlCompareOperatorType.Equals,  addMyColumn);
			}
			search = select.SqlWhereClause.GetNextSqlSearchCondition();
			search.GetSqlComparePredicate(idColumn, SqlCompareOperatorType.Equals,  myColumn);

			foreach (IColumnMap iAddIdColumnMap in propertyMap.GetAdditionalIdColumnMaps())
			{
				addIdColumnMap = iAddIdColumnMap;
				addMyTableMap = addIdColumnMap.MustGetPrimaryKeyTableMap();
				addMyColumnMap = addIdColumnMap.MustGetPrimaryKeyColumnMap();

				if (addMyTableMap == null)
					throw new MappingException("TableMap '" + addIdColumnMap.PrimaryKeyTable + "' Not Found!"); // do not localize
				if (addMyColumnMap == null)
					throw new MappingException("ColumnMap '" + addIdColumnMap.PrimaryKeyColumn + "' Not Found!"); // do not localize

				SqlColumnAlias addIdColumn = joinTable.GetSqlColumnAlias(addIdColumnMap);
				SqlColumnAlias addMyColumn = myTable.GetSqlColumnAlias(addMyColumnMap);

				search = select.SqlWhereClause.GetNextSqlSearchCondition();
				search.GetSqlComparePredicate(addIdColumn, SqlCompareOperatorType.Equals,  addMyColumn);
			}

			om = m_SqlEngineManager.Context.ObjectManager;
			foreach (IPropertyMap iMyPropertyMap in propertyMap.ClassMap.GetIdentityPropertyMaps())
			{
				myPropertyMap = iMyPropertyMap;
				columnMap = myPropertyMap.GetColumnMap();
				SqlColumnAlias column = myTable.GetSqlColumnAlias(columnMap);
				SqlParameter param;

				paramName = GetParameterName(myPropertyMap, "Id_");
				if (om.GetPropertyStatus(obj, propertyMap.Name) == PropertyStatus.Dirty)
					param = AddSqlParameter(select, parameters, paramName, obj, myPropertyMap, om.GetOriginalPropertyValue(obj, myPropertyMap.Name), columnMap, true);
				else
					param = AddSqlParameter(select, parameters, paramName, obj, myPropertyMap, om.GetPropertyValue(obj, myPropertyMap.Name), columnMap);

				search = select.SqlWhereClause.GetNextSqlSearchCondition();
				search.GetSqlComparePredicate(column, SqlCompareOperatorType.Equals,  param);
			}
			typeColumnMap = propertyMap.ClassMap.GetTypeColumnMap();
			if (typeColumnMap != null)
			{
				SqlColumnAlias typeColumn = myTable.GetSqlColumnAlias(typeColumnMap);
				paramName = GetParameterName(propertyMap.ClassMap, "Type_");
				SqlParameter param = AddSqlParameter(select, parameters, paramName, obj, null, propertyMap.ClassMap.TypeValue, typeColumnMap, true);
				search = select.SqlWhereClause.GetNextSqlSearchCondition();
				search.GetSqlComparePredicate(typeColumn, SqlCompareOperatorType.Equals,  param);
			}
			return GenerateSql(select);
		}
开发者ID:Dawn-of-Light,项目名称:Puzzle.NET,代码行数:101,代码来源:SqlEngineBase.cs

示例3: GetInsertCollectionValueStatement

		protected virtual string GetInsertCollectionValueStatement(object obj, IPropertyMap propertyMap, object value, IList parameters)
		{
			IClassMap classMap;
			IColumnMap columnMap;
			IColumnMap idColumnMap;
			IPropertyMap idPropertyMap;
			ITableMap tableMap;
			IObjectManager om = m_SqlEngineManager.Context.ObjectManager;
			string paramName;
			classMap = propertyMap.ClassMap;
			tableMap = propertyMap.MustGetTableMap();

			SqlInsertStatement insert = new SqlInsertStatement(tableMap.SourceMap);
			SqlTableAlias table = insert.GetSqlTableAlias(tableMap);

			insert.SqlInsertClause.SqlTable = table.SqlTable;

			idColumnMap = propertyMap.GetIdColumnMap();
			idPropertyMap = classMap.MustGetPropertyMapForColumnMap(idColumnMap.MustGetPrimaryKeyColumnMap());
			SqlColumnAlias idColumn = table.GetSqlColumnAlias(idColumnMap);

			paramName = GetParameterName(idPropertyMap);
			SqlParameter param = AddSqlParameter(insert, parameters, paramName, obj, idPropertyMap, om.GetPropertyValue(obj, idPropertyMap.Name), idColumnMap);
			insert.AddSqlColumnAndValue(idColumn, param);
			foreach (IColumnMap iIdColumnMap in propertyMap.GetAdditionalIdColumnMaps())
			{
				idColumnMap = iIdColumnMap;
				idColumn = table.GetSqlColumnAlias(idColumnMap);

				paramName = GetParameterName(propertyMap, idColumnMap);

				if (!(classMap.GetTypeColumnMap() == null && classMap.GetTypeColumnMap() == idColumnMap.MustGetPrimaryKeyColumnMap()))
					param = AddSqlParameter(insert, parameters, paramName, obj, null, classMap.TypeValue, idColumnMap, true);
				else
				{
					idPropertyMap = classMap.MustGetPropertyMapForColumnMap(idColumnMap.MustGetPrimaryKeyColumnMap());					
					param = AddSqlParameter(insert, parameters, paramName, obj, idPropertyMap, om.GetPropertyValue(obj, idPropertyMap.Name), idColumnMap);
				}

				insert.AddSqlColumnAndValue(idColumn, param);

			}
			columnMap = propertyMap.GetColumnMap();
			SqlColumnAlias column = table.GetSqlColumnAlias(columnMap);
			paramName = GetParameterName(propertyMap, columnMap);
			param = AddSqlParameter(insert, parameters, paramName, obj, propertyMap, value, columnMap, true);
			insert.AddSqlColumnAndValue(column, param);

			foreach (IColumnMap iColumnMap in propertyMap.GetAdditionalColumnMaps())
			{
				columnMap = iColumnMap;
				column = table.GetSqlColumnAlias(columnMap);
				paramName = GetParameterName(propertyMap, columnMap);
				param = AddSqlParameter(insert, parameters, paramName, obj, propertyMap, value, columnMap, true);
				insert.AddSqlColumnAndValue(column, param);
			}
			return GenerateSql(insert);
		}
开发者ID:Dawn-of-Light,项目名称:Puzzle.NET,代码行数:58,代码来源:SqlEngineBase.cs


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