當前位置: 首頁>>代碼示例>>C#>>正文


C# Mapping.SimpleValue類代碼示例

本文整理匯總了C#中NHibernate.Mapping.SimpleValue的典型用法代碼示例。如果您正苦於以下問題:C# SimpleValue類的具體用法?C# SimpleValue怎麽用?C# SimpleValue使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SimpleValue類屬於NHibernate.Mapping命名空間,在下文中一共展示了SimpleValue類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: UnmatchingColumns

		public void UnmatchingColumns()
		{
			Table primaryTable = new Table("pktable");
			primaryTable.PrimaryKey = new PrimaryKey();
			SimpleValue sv = new SimpleValue();
			sv.TypeName = NHibernateUtil.Int16.Name;
			Column pkColumn = new Column("pk_column");
			pkColumn.Value = sv;

			primaryTable.PrimaryKey.AddColumn(pkColumn);

			Table fkTable = new Table("fktable");

			ForeignKey fk = new ForeignKey();
			sv = new SimpleValue();
			sv.TypeName = NHibernateUtil.Int16.Name;
			Column fkColumn1 = new Column("col1");
			fkColumn1.Value = sv;

			sv = new SimpleValue();
			sv.TypeName = NHibernateUtil.Int16.Name;
			Column fkColumn2 = new Column("col2");
			fkColumn2.Value = sv;

			fk.AddColumn(fkColumn1);
			fk.AddColumn(fkColumn2);

			fk.Table = fkTable;

			fk.ReferencedTable = primaryTable;
			Assert.Throws<FKUnmatchingColumnsException>(() => fk.AlignColumns());
		}
開發者ID:NikGovorov,項目名稱:nhibernate-core,代碼行數:32,代碼來源:ForeignKeyFixture.cs

示例2: BindTimestamp

		private void BindTimestamp(HbmTimestamp timestampSchema, PersistentClass rootClass, Table table)
		{
			if (timestampSchema == null)
				return;

			string propertyName = timestampSchema.name;
			SimpleValue simpleValue = new SimpleValue(table);

			BindColumns(timestampSchema, simpleValue, propertyName);

			if (!simpleValue.IsTypeSpecified)
				simpleValue.TypeName = NHibernateUtil.Timestamp.Name;

			Mapping.Property property = new Mapping.Property(simpleValue);
			BindProperty(timestampSchema, property);

			// for version properties marked as being generated, make sure they are "always"
			// generated; "insert" is invalid. This is dis-allowed by the schema, but just to make
			// sure...

			if (property.Generation == PropertyGeneration.Insert)
				throw new MappingException("'generated' attribute cannot be 'insert' for versioning property");

			simpleValue.NullValue = timestampSchema.unsavedvalue;
			rootClass.Version = property;
			rootClass.AddProperty(property);
		}
開發者ID:pallmall,項目名稱:WCell,代碼行數:27,代碼來源:RootClassBinder.cs

示例3: CreateIdentifierProperty

		private void CreateIdentifierProperty(HbmId idSchema, PersistentClass rootClass, SimpleValue id)
		{
			if (idSchema.name != null)
			{
				string access = idSchema.access ?? mappings.DefaultAccess;
				id.SetTypeUsingReflection(rootClass.MappedClass.AssemblyQualifiedName, idSchema.name, access);

				Mapping.Property property = new Mapping.Property(id);
				property.Name = idSchema.name;

				if (property.Value.Type == null)
					throw new MappingException("could not determine a property type for: " + property.Name);

				property.PropertyAccessorName = idSchema.access ?? mappings.DefaultAccess;
				property.Cascade = mappings.DefaultCascade;
				property.IsUpdateable = true;
				property.IsInsertable = true;
				property.IsOptimisticLocked = true;
				property.Generation = PropertyGeneration.Never;
				property.MetaAttributes = GetMetas(idSchema);

				rootClass.IdentifierProperty = property;

				LogMappedProperty(property);
			}
		}
開發者ID:pallmall,項目名稱:WCell,代碼行數:26,代碼來源:ClassIdBinder.cs

示例4: BindId

		public void BindId(HbmId idSchema, PersistentClass rootClass, Table table)
		{
			if (idSchema != null)
			{
				var id = new SimpleValue(table);
				new TypeBinder(id, Mappings).Bind(idSchema.Type);

				rootClass.Identifier = id;

				Func<HbmColumn> defaultColumn = () => new HbmColumn
				{
					name = idSchema.name ?? RootClass.DefaultIdentifierColumnName,
					length = idSchema.length
				};

				new ColumnsBinder(id, Mappings).Bind(idSchema.Columns, false, defaultColumn);

				CreateIdentifierProperty(idSchema, rootClass, id);
				VerifiyIdTypeIsValid(id.Type, rootClass.EntityName);

				new IdGeneratorBinder(Mappings).BindGenerator(id, GetIdGenerator(idSchema));

				id.Table.SetIdentifierValue(id);

				BindUnsavedValue(idSchema, id);
			}
		}
開發者ID:jlevitt,項目名稱:nhibernate-core,代碼行數:27,代碼來源:ClassIdBinder.cs

示例5: BindSimpleValue

		private void BindSimpleValue(HbmDiscriminator discriminatorSchema, SimpleValue discriminator)
		{
			if (discriminatorSchema.type != null)
				discriminator.TypeName = discriminatorSchema.type;

			if (discriminatorSchema.formula != null)
			{
				var f = new Formula {FormulaString = discriminatorSchema.formula};
				discriminator.AddFormula(f);
			}
			else
			{
				new ColumnsBinder(discriminator, Mappings).Bind(discriminatorSchema.Columns, false,
				                                                () =>
				                                                new HbmColumn
				                                                	{
				                                                		name =
				                                                			mappings.NamingStrategy.PropertyToColumnName(
				                                                			RootClass.DefaultDiscriminatorColumnName),
				                                                		length = discriminatorSchema.length,
																														notnull = discriminatorSchema.notnull,
																														notnullSpecified = true
				                                                	});
			}
		}
開發者ID:jlevitt,項目名稱:nhibernate-core,代碼行數:25,代碼來源:ClassDiscriminatorBinder.cs

示例6: BindGenerator

		public void BindGenerator(SimpleValue id, HbmGenerator generatorMapping)
		{
			if (generatorMapping != null)
			{
				if ([email protected] == null)
					throw new MappingException("no class given for generator");

				// NH Differen behavior : specific feature NH-1817
				TypeDef typeDef = mappings.GetTypeDef([email protected]);
				if (typeDef != null)
				{
					id.IdentifierGeneratorStrategy = typeDef.TypeClass;
					// parameters on the property mapping should override parameters in the typedef
					var allParameters = new Dictionary<string, string>(typeDef.Parameters);
					ArrayHelper.AddAll(allParameters, GetGeneratorProperties(generatorMapping, id.Table.Schema));

					id.IdentifierGeneratorProperties = allParameters;
				}
				else
				{
					id.IdentifierGeneratorStrategy = [email protected];
					id.IdentifierGeneratorProperties = GetGeneratorProperties(generatorMapping, id.Table.Schema);
				}
			}
		}
開發者ID:paulbatum,項目名稱:nhibernate,代碼行數:25,代碼來源:IdGeneratorBinder.cs

示例7: CreateIdentifier

		private static SimpleValue CreateIdentifier(HbmId idSchema, PersistentClass rootClass, Table table)
		{
			SimpleValue iv = new SimpleValue(table);
			iv.TypeName = idSchema.type;
			rootClass.Identifier = iv;

			return iv;
		}
開發者ID:pallmall,項目名稱:WCell,代碼行數:8,代碼來源:ClassIdBinder.cs

示例8: 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

示例9: YesNoSqlType

		public void YesNoSqlType()
		{
			SimpleValue sv = new SimpleValue();
			sv.TypeName = NHibernateUtil.YesNo.Name;
			Column column = new Column();
			column.Value = sv;
			string type = column.GetSqlType(_dialect, null);
			Assert.AreEqual("CHAR(1)", type);
		}
開發者ID:tkellogg,項目名稱:NHibernate3-withProxyHooks,代碼行數:9,代碼來源:ColumnFixture.cs

示例10: TypeBinder

		public TypeBinder(SimpleValue value, Mappings mappings)
			: base(mappings)
		{
			if (value == null)
			{
				throw new ArgumentNullException("value");
			}
			this.value = value;
		}
開發者ID:hoangduc007,項目名稱:nhibernate-core,代碼行數:9,代碼來源:TypeBinder.cs

示例11: BindFk

		public static void BindFk(PersistentClass referencedEntity,
		                          PersistentClass destinationEntity,
		                          Ejb3JoinColumn[] columns,
		                          SimpleValue value,
		                          bool unique,
		                          ExtendedMappings mappings)
		{
			throw new NotImplementedException();
		}
開發者ID:hazzik,項目名稱:nh-contrib-everything,代碼行數:9,代碼來源:TableBinder.cs

示例12: MakeVersion

 public static void MakeVersion(XmlNode node, SimpleValue model)
 {
     if (node != null && node.Attributes != null)
     {
         XmlAttribute attribute = node.Attributes["unsaved-value"];
         model.NullValue = attribute == null ? null : attribute.Value;
     }
     else
         model.NullValue = null;
 }
開發者ID:zibler,項目名稱:zibler,代碼行數:10,代碼來源:RootClassBinder.cs

示例13: AddColumns

		private void AddColumns(HbmId idSchema, SimpleValue id)
		{
			if (idSchema.column1 != null)
				AddColumnFromAttribute(idSchema, id);
			else
				AddColumnsFromList(idSchema, id);

			if (id.ColumnSpan == 0)
				AddDefaultColumn(idSchema, id);
		}
開發者ID:pallmall,項目名稱:WCell,代碼行數:10,代碼來源:ClassIdBinder.cs

示例14: StringSqlType

		public void StringSqlType()
		{
			SimpleValue sv = new SimpleValue();
			sv.TypeName = NHibernateUtil.String.Name;
			Column column = new Column();
			column.Value = sv;
			Assert.AreEqual("NVARCHAR(255)", column.GetSqlType(_dialect, null));

			column.Length = 100;
			Assert.AreEqual("NVARCHAR(100)", column.GetSqlType(_dialect, null));
		}
開發者ID:tkellogg,項目名稱:NHibernate3-withProxyHooks,代碼行數:11,代碼來源:ColumnFixture.cs

示例15: CheckDefaultUnsavedValue

		private void CheckDefaultUnsavedValue( string versionTag )
		{
			string XML = GetXmlForTesting( versionTag );
			XmlDocument document = LoadAndValidate( XML );
			XmlNode node = document.GetElementsByTagName( versionTag )[0];
			SimpleValue model = new SimpleValue();
			Binder.MakeVersion( node, model );
			Assert.IsNull( model.NullValue,
				"default unsaved-value for tag {0} should be null, but is '{1}'",
				versionTag, model.NullValue );
		}
開發者ID:rcarrillopadron,項目名稱:nhibernate-1.0.2.0,代碼行數:11,代碼來源:BinderFixture.cs


注:本文中的NHibernate.Mapping.SimpleValue類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。