コード例 #1
0
        private void BindNaturalId(HbmNaturalId naturalid, PersistentClass rootClass, IDictionary <string, MetaAttribute> inheritedMetas)
        {
            if (naturalid == null)
            {
                return;
            }
            //by default, natural-ids are "immutable" (constant)
            var propBinder = new PropertiesBinder(mappings, rootClass);
            var uk         = new UniqueKey {
                Name = "_UniqueKey", Table = rootClass.Table
            };

            propBinder.Bind(naturalid.Properties, inheritedMetas, property =>
            {
                if (!naturalid.mutable)
                {
                    property.IsUpdateable = false;
                }
                property.IsNaturalIdentifier = true;

                uk.AddColumns(property.ColumnIterator.OfType <Column>());
            });

            rootClass.Table.AddUniqueKey(uk);
        }
コード例 #2
0
		private void BindNaturalId(HbmNaturalId naturalid, PersistentClass rootClass, IDictionary<string, MetaAttribute> inheritedMetas)
		{
			if (naturalid == null)
			{
				return;
			}
			//by default, natural-ids are "immutable" (constant)
			var propBinder = new PropertiesBinder(mappings, rootClass, dialect);
			var uk = new UniqueKey { Name = "_UniqueKey", Table = rootClass.Table };
			propBinder.Bind(naturalid.Properties, inheritedMetas, property =>
				{
					if (!naturalid.mutable)
						property.IsUpdateable = false;
					property.IsNaturalIdentifier = true;

					uk.AddColumns(property.ColumnIterator.OfType<Column>());
				});

			rootClass.Table.AddUniqueKey(uk);	
		}