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; }
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; }
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 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 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; }
public override IInsertGeneratedIdentifierDelegate GetInsertGeneratedIdentifierDelegate( IPostInsertIdentityPersister persister, ISessionFactoryImplementor factory, bool isGetGeneratedKeysEnabled) { return(new OutputParamReturningDelegate(persister, factory)); }
public abstract IInsertGeneratedIdentifierDelegate GetInsertGeneratedIdentifierDelegate( IPostInsertIdentityPersister persister, ISessionFactoryImplementor factory, bool isGetGeneratedKeysEnabled);
protected AbstractReturningDelegate(IPostInsertIdentityPersister persister) { this.persister = persister; }
public AbstractReturningDelegate(IPostInsertIdentityPersister persister) { this.persister = persister; }
public override IInsertGeneratedIdentifierDelegate GetInsertGeneratedIdentifierDelegate( IPostInsertIdentityPersister persister, ISessionFactoryImplementor factory, bool isGetGeneratedKeysEnabled) { return new SelectGeneratorDelegate(persister, factory, uniqueKeyPropertyName); }
public override IInsertGeneratedIdentifierDelegate GetInsertGeneratedIdentifierDelegate( IPostInsertIdentityPersister persister, ISessionFactoryImplementor factory, bool isGetGeneratedKeysEnabled) { return(new SelectGeneratorDelegate(persister, factory, uniqueKeyPropertyNames)); }
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); }
public IInsertGeneratedIdentifierDelegate GetInsertGeneratedIdentifierDelegate(IPostInsertIdentityPersister persister, ISessionFactoryImplementor factory, bool isGetGeneratedKeysEnabled) { return(new SequenceIdentityDelegate(persister, factory, SequenceName)); }