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


C# SimpleValue.AddColumn方法代码示例

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


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

示例1: BindColumns

		private void BindColumns(HbmDiscriminator discriminatorSchema, SimpleValue discriminator)
		{
			Table table = discriminator.Table;

			//COLUMN(S)
			if (discriminatorSchema.column != null)
			{
				Column col = new Column();
				col.Value = discriminator;
				BindColumn(discriminatorSchema, col);
				col.Name = mappings.NamingStrategy.ColumnName(discriminatorSchema.column);

				if (table != null)
					table.AddColumn(col);

				discriminator.AddColumn(col);
			}
			else if (discriminatorSchema.Item != null && discriminatorSchema.Item is HbmColumn)
			{
				HbmColumn theCol = (HbmColumn)discriminatorSchema.Item;
				Column col = new Column();
				col.Value = discriminator;
				BindColumn(theCol, col, false);

				col.Name = mappings.NamingStrategy.ColumnName(theCol.name);

				if (table != null)
					table.AddColumn(col);
				//table=null -> an association, fill it in later

				discriminator.AddColumn(col);

				BindIndex(theCol.index, table, col);
				BindUniqueKey(theCol.uniquekey, table, col);
			}

			if (discriminator.ColumnSpan == 0)
			{
				Column col = new Column();
				col.Value = discriminator;
				BindColumn(discriminatorSchema, col);

				col.Name = mappings.NamingStrategy.PropertyToColumnName(
					RootClass.DefaultDiscriminatorColumnName);

				discriminator.Table.AddColumn(col);
				discriminator.AddColumn(col);
			}
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:49,代码来源:ClassDiscriminatorBinder.cs

示例2: BindColumn

 protected virtual void BindColumn(SimpleValue model, ColumnMapping columnMapping)
 {
     Table table = model.Table;
     var column = CreateColumn(model, columnMapping);
     if (table != null)
         table.AddColumn(column);
     model.AddColumn(column);
 }
开发者ID:paulbatum,项目名称:Fluent-NHibernate-Semantic-Model-Rewrite,代码行数:8,代码来源:ClassBinder.cs

示例3: AddColumn

        private void AddColumn(SimpleValue id, string propName)
        {
            Column column = CreateColumn();
            column.Value = id;
            column.Name = mapper.Mappings.NamingStrategy.ColumnName(propName);

            if (id.Table != null) {
                id.Table.AddColumn(column);
            }

            id.AddColumn(column);
        }
开发者ID:osdezwart,项目名称:SolrNet,代码行数:12,代码来源:NHibernateMapper.cs

示例4: BindColumn

        private void BindColumn(SimpleValue value, bool nullable, string propName)
        {
            var col = new Column {Value = value, IsNullable = nullable, Name = mappings.NamingStrategy.ColumnName(propName)};
            value.Table.AddColumn(col);
            value.AddColumn(col);

            value.AddColumn(col);
        }
开发者ID:osdezwart,项目名称:SolrNet,代码行数:8,代码来源:NHibernateMapper.cs

示例5: BindColumns

		public static void BindColumns( XmlNode node, SimpleValue model, bool isNullable, bool autoColumn, string propertyPath, Mappings mappings )
		{
			//COLUMN(S)
			XmlAttribute columnAttribute = node.Attributes[ "column" ];
			if( columnAttribute == null )
			{
				int count = 0;
				Table table = model.Table;

				foreach( XmlNode columnElement in node.SelectNodes( nsColumn, nsmgr ) )
				{
					Column col = new Column( model.Type, count++ );
					BindColumn( columnElement, col, isNullable );

					string name = columnElement.Attributes[ "name" ].Value;
					col.Name = mappings.NamingStrategy.ColumnName( name );
					if( table != null )
					{
						table.AddColumn( col );
					}
					//table=null -> an association, fill it in later
					model.AddColumn( col );
					
					//column index
					XmlAttribute indexNode = columnElement.Attributes[ "index" ];
					if( indexNode != null && table != null )
					{
						table.GetIndex( indexNode.Value ).AddColumn( col );
					}

					//column group index (although it can serve as a separate column index)
					XmlAttribute parentElementIndexAttr = node.Attributes[ "index" ];
					if( parentElementIndexAttr != null && table != null )
					{
						table.GetIndex( parentElementIndexAttr.Value ).AddColumn( col );
					}
					XmlAttribute uniqueNode = columnElement.Attributes[ "unique-key" ];
					if( uniqueNode != null && table != null )
					{
						table.GetUniqueKey( uniqueNode.Value ).AddColumn( col );
					}
				}
			}
			else
			{
				Column col = new Column( model.Type, 0 );
				BindColumn( node, col, isNullable );
				col.Name = mappings.NamingStrategy.ColumnName( columnAttribute.Value );
				Table table = model.Table;
				if( table != null )
				{
					table.AddColumn( col );
				} //table=null -> an association - fill it in later
				model.AddColumn( col );
				//column group index (although can serve as a separate column index)
				XmlAttribute indexAttr = node.Attributes[ "index" ];
				if( indexAttr != null && table != null )
				{
					table.GetIndex( indexAttr.Value ).AddColumn( col );
				}
			}

			if( autoColumn && model.ColumnSpan == 0 )
			{
				Column col = new Column( model.Type, 0 );
				BindColumn( node, col, isNullable );
				col.Name = mappings.NamingStrategy.PropertyToColumnName( propertyPath );
				model.Table.AddColumn( col );
				model.AddColumn( col );
			}
		}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:71,代码来源:Binder.cs

示例6: BindColumns

        protected void BindColumns(XmlNode node, SimpleValue model, bool isNullable, bool autoColumn,
			string propertyPath)
        {
            Table table = model.Table;
            //COLUMN(S)
            XmlAttribute columnAttribute = node.Attributes["column"];
            if (columnAttribute == null)
            {
                int count = 0;

                foreach (XmlNode columnElement in node.SelectNodes(HbmConstants.nsColumn, namespaceManager))
                {
                    Column col = new Column();
                    col.Value = model;
                    col.TypeIndex = count++;
                    BindColumn(columnElement, col, isNullable);

                    string name = columnElement.Attributes["name"].Value;
                    col.Name = mappings.NamingStrategy.ColumnName(name);
                    if (table != null)
                        table.AddColumn(col);
                    //table=null -> an association, fill it in later
                    model.AddColumn(col);

                    //column index
                    BindIndex(columnElement.Attributes["index"], table, col);
                    //column group index (although it can serve as a separate column index)
                    BindIndex(node.Attributes["index"], table, col);

                    BindUniqueKey(columnElement.Attributes["unique-key"], table, col);
                    BindUniqueKey(node.Attributes["unique-key"], table, col);
                }
            }
            else
            {
                Column col = new Column();
                col.Value = model;
                BindColumn(node, col, isNullable);
                col.Name = mappings.NamingStrategy.ColumnName(columnAttribute.Value);
                if (table != null)
                    table.AddColumn(col);
                model.AddColumn(col);
                //column group index (although can serve as a separate column index)
                BindIndex(node.Attributes["index"], table, col);
                BindUniqueKey(node.Attributes["unique-key"], table, col);
            }

            if (autoColumn && model.ColumnSpan == 0)
            {
                Column col = new Column();
                col.Value = model;
                BindColumn(node, col, isNullable);
                col.Name = mappings.NamingStrategy.PropertyToColumnName(propertyPath);
                model.Table.AddColumn(col);
                model.AddColumn(col);
                //column group index (although can serve as a separate column index)
                BindIndex(node.Attributes["index"], table, col);
                BindUniqueKey(node.Attributes["unique-key"], table, col);
            }
        }
开发者ID:aistrate,项目名称:TypingPracticeTexts,代码行数:60,代码来源:ClassBinder.cs

示例7: BindColumns

		private void BindColumns(HbmKeyProperty keyPropertySchema, SimpleValue model, bool isNullable, bool autoColumn,
			string propertyPath)
		{
			Table table = model.Table;

			if (keyPropertySchema.column1 == null)
			{
				int count = 0;

				foreach (HbmColumn columnSchema in keyPropertySchema.column ?? new HbmColumn[0])
				{
					Column col = new Column();
					col.Value = model;
					col.TypeIndex = count++;
					BindColumn(columnSchema, col, isNullable);

					col.Name = mappings.NamingStrategy.ColumnName(columnSchema.name);
					if (table != null)
						table.AddColumn(col);
					//table=null -> an association, fill it in later
					model.AddColumn(col);

					//column index
					BindIndex(columnSchema.index, table, col);
					//column group index (although it can serve as a separate column index)

					BindUniqueKey(columnSchema.uniquekey, table, col);
				}
			}
			else
			{
				Column col = new Column();
				col.Value = compositeId;
				BindColumn(keyPropertySchema, col, isNullable);
				col.Name = mappings.NamingStrategy.ColumnName(keyPropertySchema.column1);
				if (table != null)
					table.AddColumn(col);
				model.AddColumn(col);
				//column group index (although can serve as a separate column index)
			}

			if (autoColumn && model.ColumnSpan == 0)
			{
				Column col = new Column();
				col.Value = model;
				BindColumn(keyPropertySchema, col, isNullable);
				col.Name = mappings.NamingStrategy.PropertyToColumnName(propertyPath);
				model.Table.AddColumn(col);
				model.AddColumn(col);
				//column group index (although can serve as a separate column index)
			}
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:52,代码来源:ClassCompositeIdBinder.cs

示例8: linkWithValue

 public void linkWithValue(SimpleValue value)
 {
     if (formula != null)
     {
         value.AddFormula(formula);
     }
     else
     {
         MappingColumn.Value = value;
         value.AddColumn(MappingColumn);
         value.Table.AddColumn(MappingColumn);
         AddColumnBinding(value);
         table = value.Table;
     }
 }
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:15,代码来源:Ejb3Column.cs

示例9: BindJoin

		private void BindJoin(HbmJoin joinMapping, Join join, IDictionary<string, MetaAttribute> inheritedMetas)
		{
			PersistentClass persistentClass = join.PersistentClass;

			// TABLENAME
			string schema = joinMapping.schema ?? mappings.SchemaName;
			string catalog = joinMapping.catalog ?? mappings.CatalogName;

			string action = "all"; // joinMapping.schemaaction ?? "all";

			string tableName = joinMapping.table;
			Table table = mappings.AddTable(schema, catalog, GetClassTableName(persistentClass, tableName), joinMapping.Subselect, false, action);
			join.Table = table;

			join.IsSequentialSelect = joinMapping.fetch == HbmJoinFetch.Select;
			join.IsInverse = joinMapping.inverse;
			join.IsOptional = joinMapping.optional;

			log.InfoFormat("Mapping class join: {0} -> {1}", persistentClass.EntityName, join.Table.Name);

			// KEY
			SimpleValue key;
			if (!String.IsNullOrEmpty(joinMapping.key.propertyref))
			{
				string propertyRef = joinMapping.key.propertyref;
				var propertyRefKey = new SimpleValue(persistentClass.Table)
					{
						IsAlternateUniqueKey = true
					};
				var property = persistentClass.GetProperty(propertyRef);
				join.RefIdProperty = property;
				//we only want one column
				var column = (Column) property.ColumnIterator.First();
				if (!column.Unique)
					throw new MappingException(
						string.Format(
							"Property {0}, on class {1} must be marked as unique to be joined to with a property-ref.",
							property.Name,
							persistentClass.ClassName));
				propertyRefKey.AddColumn(column);
				propertyRefKey.TypeName = property.Type.Name;
				key = new ReferenceDependantValue(table, propertyRefKey);
			}
			else
			{
				key = new DependantValue(table, persistentClass.Identifier);
			}

			key.ForeignKeyName = joinMapping.key.foreignkey;
			join.Key = key;
			key.IsCascadeDeleteEnabled = joinMapping.key.ondelete == HbmOndelete.Cascade;
			new ValuePropertyBinder(key, Mappings).BindSimpleValue(joinMapping.key, persistentClass.EntityName, false);

			join.CreatePrimaryKey(dialect);
			join.CreateForeignKey();

			// PROPERTIES
			new PropertiesBinder(Mappings, persistentClass, dialect).Bind(joinMapping.Properties, join.Table,
																							inheritedMetas, p => { },
																							join.AddProperty);

			// CUSTOM SQL
			HandleCustomSQL(joinMapping, join);
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:64,代码来源:ClassBinder.cs

示例10: BindColumns

		private void BindColumns(HbmVersion versionSchema, SimpleValue model, bool isNullable, string propertyPath)
		{
			Table table = model.Table;

			if (versionSchema.column != null)
			{
				Column col = new Column();
				col.Value = model;
				BindColumn(col, isNullable);
				col.Name = mappings.NamingStrategy.ColumnName(versionSchema.column);

				if (table != null)
					table.AddColumn(col);

				model.AddColumn(col);
			}

			if (model.ColumnSpan == 0)
			{
				Column col = new Column();
				col.Value = model;
				BindColumn(col, isNullable);
				col.Name = mappings.NamingStrategy.PropertyToColumnName(propertyPath);
				model.Table.AddColumn(col);
				model.AddColumn(col);
			}
		}
开发者ID:pallmall,项目名称:WCell,代码行数:27,代码来源:RootClassBinder.cs

示例11: AddColumn

        private static void AddColumn(PersistentClass mapping, string columnName, Type accessorType)
        {
            var typeName = DICT_TYPE_TO_NAME[accessorType];
            bool isNullable = typeName[typeName.Length - 1] == '?';
            if (isNullable)
                typeName = typeName.Substring(0, typeName.Length - 1);

            // String annotations can be null also
            isNullable = isNullable || Equals(STRING_TYPE_NAME, typeName);

            var column = new Column(columnName) {IsNullable = isNullable};
            mapping.Table.AddColumn(column);
            var value = new SimpleValue(mapping.Table) {TypeName = typeName};
            value.AddColumn(column);
            var property = new Property(value)
            {
                Name = columnName,
                PropertyAccessorName = accessorType.AssemblyQualifiedName
            };
            mapping.AddProperty(property);
        }
开发者ID:lgatto,项目名称:proteowizard,代码行数:21,代码来源:SessionFactoryFactory.cs

示例12: AddDefaultColumn

        private void AddDefaultColumn(HbmId idSchema, SimpleValue id)
        {
            Column column = CreateColumn(idSchema);
            column.Value = id;
            string propertyName = idSchema.name ?? RootClass.DefaultIdentifierColumnName;
            column.Name = mappings.NamingStrategy.PropertyToColumnName(propertyName);

            id.Table.AddColumn(column);
            id.AddColumn(column);
        }
开发者ID:zibler,项目名称:zibler,代码行数:10,代码来源:ClassIdBinder.cs

示例13: AddColumnsFromList

        private void AddColumnsFromList(HbmId idSchema, SimpleValue id)
        {
            int count = 0;

            foreach (HbmColumn columnSchema in idSchema.column ?? new HbmColumn[0])
            {
                Column column = CreateColumn(columnSchema, id, count++);
                column.Name = mappings.NamingStrategy.ColumnName(columnSchema.name);

                if (id.Table != null)
                    id.Table.AddColumn(column);
                //table=null -> an association, fill it in later

                id.AddColumn(column);

                if (columnSchema.index != null && id.Table != null)
                {
                    StringTokenizer tokens = new StringTokenizer(columnSchema.index, ", ");
                    foreach (string token in tokens)
                        id.Table.GetOrCreateIndex(token).AddColumn(column);
                }

                if (columnSchema.uniquekey != null && id.Table != null)
                {
                    StringTokenizer tokens = new StringTokenizer(columnSchema.uniquekey, ", ");
                    foreach (string token in tokens)
                        id.Table.GetOrCreateUniqueKey(token).AddColumn(column);
                }
            }
        }
开发者ID:zibler,项目名称:zibler,代码行数:30,代码来源:ClassIdBinder.cs

示例14: AddColumnFromAttribute

        private void AddColumnFromAttribute(HbmId idSchema, SimpleValue id)
        {
            Column column = CreateColumn(idSchema);
            column.Value = id;
            column.Name = mappings.NamingStrategy.ColumnName(idSchema.column1);

            if (id.Table != null)
                id.Table.AddColumn(column);

            id.AddColumn(column);
        }
开发者ID:zibler,项目名称:zibler,代码行数:11,代码来源:ClassIdBinder.cs

示例15: BindColumns

		private void BindColumns(HbmVersion versionSchema, SimpleValue model, bool isNullable, string propertyPath)
		{
			Table table = model.Table;
			if (versionSchema.column1 != null)
			{
				var col = new Column {Value = model};
				BindColumn(col, isNullable);
				col.Name = mappings.NamingStrategy.ColumnName(versionSchema.column1);

				if (table != null)
					table.AddColumn(col);

				model.AddColumn(col);
			}
			else if (versionSchema.column != null)
			{
				foreach (HbmColumn hbmColumn in versionSchema.column)
				{
					var col = new Column {Value = model};
					BindColumn(hbmColumn, col, isNullable);
					if (table != null)
						table.AddColumn(col);

					model.AddColumn(col);
				}
			}

			if (model.ColumnSpan == 0)
			{
				var col = new Column {Value = model};
				BindColumn(col, isNullable);
				col.Name = mappings.NamingStrategy.PropertyToColumnName(propertyPath);
				model.Table.AddColumn(col);
				model.AddColumn(col);
			}
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:36,代码来源:RootClassBinder.cs


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