本文整理汇总了C#中ISessionFactoryImplementor.GetPersister方法的典型用法代码示例。如果您正苦于以下问题:C# ISessionFactoryImplementor.GetPersister方法的具体用法?C# ISessionFactoryImplementor.GetPersister怎么用?C# ISessionFactoryImplementor.GetPersister使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISessionFactoryImplementor
的用法示例。
在下文中一共展示了ISessionFactoryImplementor.GetPersister方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AbstractCollectionPersister
public AbstractCollectionPersister( Mapping.Collection collection, ISessionFactoryImplementor factory )
{
this.factory = factory;
dialect = factory.Dialect;
//sqlExceptionConverter = factory.SQLExceptionConverter;
collectionType = collection.CollectionType;
role = collection.Role;
ownerClass = collection.OwnerClass;
Alias alias = new Alias( "__" );
sqlOrderByString = collection.OrderBy;
hasOrder = sqlOrderByString != null;
sqlOrderByStringTemplate = hasOrder ? Template.RenderOrderByStringTemplate( sqlOrderByString, dialect ) : null;
sqlWhereString = collection.Where;
hasWhere = sqlWhereString != null;
sqlWhereStringTemplate = hasWhere ? Template.RenderWhereStringTemplate( sqlWhereString, dialect ) : null;
hasOrphanDelete = collection.OrphanDelete;
batchSize = collection.BatchSize;
cache = collection.Cache;
keyType = collection.Key.Type;
int keySpan = collection.Key.ColumnSpan;
keyColumnNames = new string[keySpan];
string[ ] keyAliases = new string[keySpan];
int k = 0;
foreach( Column col in collection.Key.ColumnCollection )
{
keyColumnNames[ k ] = col.GetQuotedName( dialect );
keyAliases[ k ] = col.Alias( dialect );
k++;
}
keyColumnAliases = alias.ToAliasStrings( keyAliases, dialect );
//unquotedKeyColumnNames = StringHelper.Unquote( keyColumnAliases );
ISet distinctColumns = new HashedSet();
CheckColumnDuplication( distinctColumns, collection.Key.ColumnCollection );
//isSet = collection.IsSet;
//isSorted = collection.IsSorted;
primitiveArray = collection.IsPrimitiveArray;
array = collection.IsArray;
IValue element = collection.Element;
int elementSpan = element.ColumnSpan;
ICollection iter = element.ColumnCollection;
Table table = collection.CollectionTable;
enableJoinedFetch = element.OuterJoinFetchSetting;
elementType = element.Type;
if( !collection.IsOneToMany )
{
CheckColumnDuplication( distinctColumns, element.ColumnCollection );
}
if( elementType.IsEntityType )
{
elementPersister = factory.GetPersister( ( ( EntityType ) elementType ).AssociatedClass );
}
else
{
elementPersister = null;
}
qualifiedTableName = table.GetQualifiedName( dialect, factory.DefaultSchema );
string[ ] aliases = new string[elementSpan];
elementColumnNames = new string[elementSpan];
int j = 0;
foreach( Column col in iter )
{
elementColumnNames[ j ] = col.GetQuotedName( dialect );
aliases[ j ] = col.Alias( dialect );
j++;
}
elementColumnAliases = alias.ToAliasStrings( aliases, dialect );
IType selectColumns;
string[ ] selectType;
hasIndex = collection.IsIndexed;
if( hasIndex )
{
IndexedCollection indexedCollection = ( IndexedCollection ) collection;
indexType = indexedCollection.Index.Type;
int indexSpan = indexedCollection.Index.ColumnSpan;
indexColumnNames = new string[indexSpan];
string[ ] indexAliases = new string[indexSpan];
int i = 0;
foreach( Column indexCol in indexedCollection.Index.ColumnCollection )
{
indexAliases[ i ] = indexCol.Alias( dialect );
indexColumnNames[ i ] = indexCol.GetQuotedName( dialect );
i++;
}
//.........这里部分代码省略.........
示例2: CreateUniqueKeyLoaders
protected void CreateUniqueKeyLoaders( ISessionFactoryImplementor factory )
{
// TODO: Does not handle components, or properties of a joined subclass
for( int i = 0; i < propertyNames.Length; i++ )
{
string[ ] columns = ( string[ ] ) uniqueKeyColumns[ propertyNames[ i ] ];
if( columns != null )
{
IType uniqueKeyType = propertyTypes[ i ];
if( uniqueKeyType.IsEntityType )
{
System.Type clazz = ( ( EntityType ) uniqueKeyType ).AssociatedClass;
uniqueKeyType = factory.GetPersister( clazz ).IdentifierType;
}
uniqueKeyLoaders.Add( propertyNames[ i ], new EntityLoader( this, columns, uniqueKeyType, 1, factory ) );
}
}
}
示例3: IsJoinedFetchEnabledByDefault
/// <summary>
/// Does the mapping, and Hibernate default semantics, specify that
/// this association should be fetched by outer joining
/// </summary>
/// <param name="config"></param>
/// <param name="type"></param>
/// <param name="factory"></param>
/// <returns></returns>
protected bool IsJoinedFetchEnabledByDefault( OuterJoinFetchStrategy config, IAssociationType type, ISessionFactoryImplementor factory )
{
if ( !type.IsEntityType && !type.IsPersistentCollectionType )
{
return false;
}
else
{
switch ( config )
{
case OuterJoinFetchStrategy.Eager:
return true;
case OuterJoinFetchStrategy.Lazy:
return false;
case OuterJoinFetchStrategy.Auto:
if ( !factory.IsOuterJoinedFetchEnabled )
{
return false;
}
if ( type.IsEntityType )
{
EntityType entityType = type as EntityType;
IClassPersister persister = factory.GetPersister( entityType.AssociatedClass );
return !persister.HasProxy || (
entityType.IsOneToOne &&
( (OneToOneType) entityType).IsNullable
);
}
else
{
return false;
}
default:
throw new ArgumentOutOfRangeException( "config", config, "Unknown OJ strategy " + config.ToString() );
}
}
}
示例4: GetPropertyMapping
private static IQueryable GetPropertyMapping( System.Type persistentClass, ISessionFactoryImplementor sessionFactory )
{
return ( IQueryable ) sessionFactory.GetPersister( persistentClass );
}