本文整理汇总了C#中ISessionFactoryImplementor.GetClassMetadata方法的典型用法代码示例。如果您正苦于以下问题:C# ISessionFactoryImplementor.GetClassMetadata方法的具体用法?C# ISessionFactoryImplementor.GetClassMetadata怎么用?C# ISessionFactoryImplementor.GetClassMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISessionFactoryImplementor
的用法示例。
在下文中一共展示了ISessionFactoryImplementor.GetClassMetadata方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTypedValues
public override TypedValue[] GetTypedValues(ISessionFactoryImplementor sessionFactory, System.Type persistentClass, IDictionary aliasClasses)
{
IClassMetadata meta = sessionFactory.GetClassMetadata( persistentClass );
string[] propertyNames = meta.PropertyNames;
IType[] propertyTypes = meta.PropertyTypes;
object[] values = meta.GetPropertyValues( _entity );
ArrayList list = new ArrayList();
for( int i = 0; i < propertyNames.Length; i++ )
{
object value = values[ i ];
IType type = propertyTypes[ i ];
string name = propertyNames[ i ];
bool isPropertyIncluded = ( i != meta.VersionProperty && IsPropertyIncluded( value, name, type ) );
if( isPropertyIncluded )
{
if( propertyTypes[ i ].IsComponentType )
{
AddComponentTypedValues( name, value, (IAbstractComponentType)type, list );
}
else
{
AddPropertyTypedValue( value, type, list );
}
}
}
return (TypedValue[])list.ToArray( typeof( TypedValue ) );
}
示例2: ToSqlString
public override SqlString ToSqlString(
ISessionFactoryImplementor factory,
System.Type persistentClass,
string alias,
IDictionary aliasClasses )
{
SqlStringBuilder builder = new SqlStringBuilder();
builder.Add( StringHelper.OpenParen );
IClassMetadata meta = factory.GetClassMetadata( persistentClass );
String[] propertyNames = meta.PropertyNames;
IType[] propertyTypes = meta.PropertyTypes;
object[] propertyValues = meta.GetPropertyValues( _entity );
for( int i = 0; i < propertyNames.Length; i++ )
{
object propertyValue = propertyValues[ i ];
String propertyName = propertyNames[ i ];
bool isPropertyIncluded = i != meta.VersionProperty &&
IsPropertyIncluded( propertyValue, propertyName, propertyTypes[ i ] );
if( isPropertyIncluded )
{
if( propertyTypes[ i ].IsComponentType )
{
AppendComponentCondition(
propertyName,
propertyValue,
(IAbstractComponentType)propertyTypes[ i ],
persistentClass,
alias,
aliasClasses,
factory,
builder
);
}
else
{
AppendPropertyCondition(
propertyName,
propertyValue,
persistentClass,
alias,
aliasClasses,
factory,
builder
);
}
}
}
if( builder.Count == 1 )
{
builder.Add( "1=1" ); // yuck!
}
builder.Add( StringHelper.ClosedParen );
return builder.ToSqlString();
}