Example #1
0
        private void ProcessUniqueId(IUniqueId uniqueId, XmlNode classNode)
        {
            bool canDeclare = true;

            foreach (IAttribute attribute in uniqueId.Attributes)
            {
                canDeclare = canDeclare &&
                             !attribute.Processed &&
                             (attribute.UsedInRelations.Count == 0);
                if (!canDeclare)
                {
                    break;
                }
            }

            //?? The element 'class' in namespace 'urn:nhibernate-mapping-2.2' has invalid child element 'natural-id'
//			if (canDeclare && false) {
//	            XmlNode constraintNode = map.CreateElement("natural-id");
//				foreach(IAttribute attribute in uniqueId.Attributes) {
//					DeclareProperty(attribute, constraintNode);
//					processedAttributes.Add(attribute);
//				}
//	            classNode.AppendChild(constraintNode);
//			}
        }
Example #2
0
        IObjectPluginConfig GetFinalDic(object key, IUniqueId id)
        {
            IObjectPluginConfig finalDic = _dic.GetObjectPluginConfig(this, SharedDicTestContext.Plugins[0]);

            Assert.IsNotNull(finalDic);
            return(finalDic);
        }
Example #3
0
 public void WriteCreateUniqueConstraint(IUniqueId constraint, IEnvironmentHelper environment)
 {
     WriteLine("ALTER TABLE {0}", constraint.Entity.Persistence.FullName);
     Indent++;
     WriteLine("ADD CONSTRAINT {0} UNIQUE ({1})",
               constraint.Persistence.Name,
               constraint.Attributes.ToPersistentNamesString(","));
 }
Example #4
0
        internal object GetLocalRowId(IUniqueId obj)
        {
            _db.CreateTable <HttpMapping>();

            var mapping = _db
                          .Table <HttpMapping>()
                          .FirstOrDefault(
                m => m.RemoteId.Equals(obj.UniqueId));

            if (mapping != null)
            {
                return(mapping.LocalId);
            }
            return(DBNull.Value);
        }
 public ILayerMethod GetProxyByUniqueId(IUniqueId uniqueId, IEnvironmentHelper environment)
 {
     return(new LayerMethod(String.Format("Get{0}By{1}", uniqueId.Entity.Name, uniqueId.Attributes.ToNamesString("")),
                            environment.ToParams(uniqueId.Attributes)));
 }
Example #6
0
 IObjectPluginConfig GetFinalDic( object key, IUniqueId id )
 {
     IObjectPluginConfig finalDic = _dic.GetObjectPluginConfig( this, SharedDicTestContext.Plugins[0] );
     Assert.IsNotNull( finalDic );
     return finalDic;
 }
Example #7
0
 public void WriteDropUniqueConstraint(IUniqueId constraint, IEnvironmentHelper environment)
 {
     WriteLine("ALTER TABLE {0} DROP UNIQUE {1}",
               constraint.Entity.Persistence.FullName,
               constraint.Persistence.Name);
 }