Ejemplo n.º 1
0
            internal SelectGeneratorDelegate(IPostInsertIdentityPersister persister, ISessionFactoryImplementor factory,
                                             string suppliedUniqueKeyPropertyNames) : base(persister)
            {
                this.persister = persister;
                this.factory   = factory;

                uniqueKeySuppliedPropertyNames = suppliedUniqueKeyPropertyNames?.Split(',').ToArray(p => p.Trim());

                idSelectString = persister.GetSelectByUniqueKeyString(uniqueKeySuppliedPropertyNames, out uniqueKeyTypes);
                idType         = persister.IdentifierType;
            }
Ejemplo n.º 2
0
 public OutputParamReturningDelegate(IPostInsertIdentityPersister persister, ISessionFactoryImplementor factory)
     : base(persister)
 {
     if (Persister.RootTableKeyColumnNames.Length > 1)
     {
         throw new HibernateException("identity-style generator cannot be used with multi-column keys");
     }
     paramType    = Persister.IdentifierType.SqlTypes(factory)[0];
     idColumnName = Persister.RootTableKeyColumnNames[0];
     this.factory = factory;
 }
			internal SelectGeneratorDelegate(IPostInsertIdentityPersister persister, ISessionFactoryImplementor factory,
			                                 string suppliedUniqueKeyPropertyName) : base(persister)
			{
				this.persister = persister;
				this.factory = factory;
				uniqueKeyPropertyName = DetermineNameOfPropertyToUse((IEntityPersister) persister, suppliedUniqueKeyPropertyName);

				idSelectString = persister.GetSelectByUniqueKeyString(uniqueKeyPropertyName);
				uniqueKeyType = ((IEntityPersister) persister).GetPropertyType(uniqueKeyPropertyName);
				idType = persister.IdentifierType;
			}
Ejemplo n.º 4
0
            internal SelectGeneratorDelegate(IPostInsertIdentityPersister persister, ISessionFactoryImplementor factory,
                                             string suppliedUniqueKeyPropertyName) : base(persister)
            {
                this.persister        = persister;
                this.factory          = factory;
                uniqueKeyPropertyName = DetermineNameOfPropertyToUse((IEntityPersister)persister, suppliedUniqueKeyPropertyName);

                idSelectString = persister.GetSelectByUniqueKeyString(uniqueKeyPropertyName);
                uniqueKeyType  = ((IEntityPersister)persister).GetPropertyType(uniqueKeyPropertyName);
                idType         = persister.IdentifierType;
            }
		public OutputParamReturningDelegate(IPostInsertIdentityPersister persister, ISessionFactoryImplementor factory)
			: base(persister)
		{
			if (Persister.RootTableKeyColumnNames.Length > 1)
			{
				throw new HibernateException("identity-style generator cannot be used with multi-column keys");
			}
			paramType = Persister.IdentifierType.SqlTypes(factory)[0];
			idColumnName = Persister.RootTableKeyColumnNames[0];
			this.factory = factory;
		}
 public override IInsertGeneratedIdentifierDelegate GetInsertGeneratedIdentifierDelegate(
     IPostInsertIdentityPersister persister, ISessionFactoryImplementor factory, bool isGetGeneratedKeysEnabled)
 {
     if (isGetGeneratedKeysEnabled)
     {
         throw new NotSupportedException();
     }
     else if (factory.Dialect.SupportsInsertSelectIdentity)
     {
         return(new InsertSelectDelegate(persister, factory));
     }
     else
     {
         return(new BasicDelegate(persister, factory));
     }
 }
Ejemplo n.º 7
0
		public override IInsertGeneratedIdentifierDelegate GetInsertGeneratedIdentifierDelegate(
			IPostInsertIdentityPersister persister, ISessionFactoryImplementor factory, bool isGetGeneratedKeysEnabled)
		{
			if (isGetGeneratedKeysEnabled)
			{
				throw new NotSupportedException();
			}
			else if (factory.Dialect.SupportsInsertSelectIdentity)
			{
				return new InsertSelectDelegate(persister, factory);
			}
			else
			{
				return new BasicDelegate(persister, factory);
			}
		}
        public static SqlString GetSelectByUniqueKeyString(
            this IPostInsertIdentityPersister persister,
            string[] suppliedPropertyNames,
            out IType[] parameterTypes)
        {
            if (persister is ICompositeKeyPostInsertIdentityPersister compositeKeyPersister)
            {
                return(compositeKeyPersister.GetSelectByUniqueKeyString(suppliedPropertyNames, out parameterTypes));
            }

            if (suppliedPropertyNames.Length > 1)
            {
                throw new IdentifierGenerationException(
                          $"persister {persister} does not implement {nameof(ICompositeKeyPostInsertIdentityPersister)}, " +
                          $"which is required for selecting by an unique key spanning multiple properties.");
            }

            if (persister is IEntityPersister entityPersister)
            {
                var uniqueKeyPropertyNames = suppliedPropertyNames ?? DetermineNameOfPropertiesToUse(entityPersister);

                parameterTypes = uniqueKeyPropertyNames.ToArray(p => entityPersister.GetPropertyType(p));
            }
            else if (persister is IQueryableCollection collectionPersister)
            {
                parameterTypes = new[] { collectionPersister.KeyType, collectionPersister.ElementType };
            }
            else
            {
                throw new IdentifierGenerationException(
                          $"Persister type {persister.GetType()} is not supported by post insert identity persisters");
            }
#pragma warning disable 618
            return(persister.GetSelectByUniqueKeyString(suppliedPropertyNames[0]));

#pragma warning restore 618
        }
 protected internal AbstractSelectingDelegate(IPostInsertIdentityPersister persister)
 {
     this.persister = persister;
 }
 public InsertSelectDelegate(IPostInsertIdentityPersister persister, ISessionFactoryImplementor factory)
     : base(persister)
 {
     this.persister = persister;
     this.factory   = factory;
 }
Ejemplo n.º 11
0
 public override IInsertGeneratedIdentifierDelegate GetInsertGeneratedIdentifierDelegate(
     IPostInsertIdentityPersister persister, ISessionFactoryImplementor factory, bool isGetGeneratedKeysEnabled)
 {
     return(new OutputParamReturningDelegate(persister, factory));
 }
Ejemplo n.º 12
0
 public abstract IInsertGeneratedIdentifierDelegate GetInsertGeneratedIdentifierDelegate(
     IPostInsertIdentityPersister persister, ISessionFactoryImplementor factory, bool isGetGeneratedKeysEnabled);
Ejemplo n.º 13
0
			public InsertSelectDelegate(IPostInsertIdentityPersister persister, ISessionFactoryImplementor factory)
				: base(persister)
			{
				this.persister = persister;
				this.factory = factory;
			}
Ejemplo n.º 14
0
 protected AbstractReturningDelegate(IPostInsertIdentityPersister persister)
 {
     this.persister = persister;
 }
Ejemplo n.º 15
0
 public AbstractReturningDelegate(IPostInsertIdentityPersister persister)
 {
     this.persister = persister;
 }
Ejemplo n.º 16
0
		public override IInsertGeneratedIdentifierDelegate GetInsertGeneratedIdentifierDelegate(
			IPostInsertIdentityPersister persister, ISessionFactoryImplementor factory, bool isGetGeneratedKeysEnabled)
		{
			return new SelectGeneratorDelegate(persister, factory, uniqueKeyPropertyName);
		}
Ejemplo n.º 17
0
 public override IInsertGeneratedIdentifierDelegate GetInsertGeneratedIdentifierDelegate(
     IPostInsertIdentityPersister persister, ISessionFactoryImplementor factory, bool isGetGeneratedKeysEnabled)
 {
     return(new SelectGeneratorDelegate(persister, factory, uniqueKeyPropertyNames));
 }
Ejemplo n.º 18
0
		protected internal AbstractSelectingDelegate(IPostInsertIdentityPersister persister)
		{
			this.persister = persister;
		}
Ejemplo n.º 19
0
		public abstract IInsertGeneratedIdentifierDelegate GetInsertGeneratedIdentifierDelegate(
			IPostInsertIdentityPersister persister, ISessionFactoryImplementor factory, bool isGetGeneratedKeysEnabled);
		public override IInsertGeneratedIdentifierDelegate GetInsertGeneratedIdentifierDelegate(
			IPostInsertIdentityPersister persister, ISessionFactoryImplementor factory, bool isGetGeneratedKeysEnabled)
		{
			return new OutputParamReturningDelegate(persister, factory);
		}
			public SequenceIdentityDelegate(IPostInsertIdentityPersister persister, ISessionFactoryImplementor factory,
			                                string sequenceName) : base(persister, factory)
			{
				sequenceNextValFragment = factory.Dialect.GetSelectSequenceNextValString(sequenceName);
			}
		public IInsertGeneratedIdentifierDelegate GetInsertGeneratedIdentifierDelegate(IPostInsertIdentityPersister persister,
		                                                                               ISessionFactoryImplementor factory,
		                                                                               bool isGetGeneratedKeysEnabled)
		{
			return new SequenceIdentityDelegate(persister, factory, SequenceName);
		}
Ejemplo n.º 23
0
 public SequenceIdentityDelegate(IPostInsertIdentityPersister persister, ISessionFactoryImplementor factory,
                                 string sequenceName) : base(persister, factory)
 {
     sequenceNextValFragment = factory.Dialect.GetSelectSequenceNextValString(sequenceName);
 }
Ejemplo n.º 24
0
 public IInsertGeneratedIdentifierDelegate GetInsertGeneratedIdentifierDelegate(IPostInsertIdentityPersister persister,
                                                                                ISessionFactoryImplementor factory,
                                                                                bool isGetGeneratedKeysEnabled)
 {
     return(new SequenceIdentityDelegate(persister, factory, SequenceName));
 }