本文整理汇总了C#中NHibernate.SqlCommand.SelectFragment类的典型用法代码示例。如果您正苦于以下问题:C# SelectFragment类的具体用法?C# SelectFragment怎么用?C# SelectFragment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SelectFragment类属于NHibernate.SqlCommand命名空间,在下文中一共展示了SelectFragment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateIdInsertSelect
protected SqlString GenerateIdInsertSelect(IQueryable persister, string tableAlias, IASTNode whereClause)
{
var select = new SqlSelectBuilder(Factory);
SelectFragment selectFragment = new SelectFragment(Factory.Dialect)
.AddColumns(tableAlias, persister.IdentifierColumnNames, persister.IdentifierColumnNames);
select.SetSelectClause(selectFragment.ToFragmentString().Substring(2));
string rootTableName = persister.TableName;
SqlString fromJoinFragment = persister.FromJoinFragment(tableAlias, true, false);
SqlString whereJoinFragment = persister.WhereJoinFragment(tableAlias, true, false);
select.SetFromClause(rootTableName + ' ' + tableAlias + fromJoinFragment);
if (whereJoinFragment == null)
{
whereJoinFragment = SqlString.Empty;
}
else
{
whereJoinFragment = whereJoinFragment.Trim();
if (whereJoinFragment.StartsWithCaseInsensitive("and "))
{
whereJoinFragment = whereJoinFragment.Substring(4);
}
}
SqlString userWhereClause = SqlString.Empty;
if (whereClause.ChildCount != 0)
{
// If a where clause was specified in the update/delete query, use it to limit the
// returned ids here...
try
{
var nodes = new CommonTreeNodeStream(whereClause);
var gen = new SqlGenerator(Factory, nodes);
gen.whereClause();
userWhereClause = gen.GetSQL().Substring(7);
}
catch (RecognitionException e)
{
throw new HibernateException("Unable to generate id select for DML operation", e);
}
if (whereJoinFragment.Length > 0)
{
whereJoinFragment.Append(" and ");
}
}
select.SetWhereClause(whereJoinFragment + userWhereClause);
var insert = new InsertSelect();
if (Factory.Settings.IsCommentsEnabled)
{
insert.SetComment("insert-select for " + persister.EntityName + " ids");
}
insert.SetTableName(persister.TemporaryIdTableName);
insert.SetSelect(select);
return insert.ToSqlString();
}
示例2: AddDiscriminatorToSelect
protected override void AddDiscriminatorToSelect(SelectFragment select, string name, string suffix)
{
if (IsDiscriminatorFormula)
select.AddFormula(name, DiscriminatorFormulaTemplate, DiscriminatorAlias);
else
select.AddColumn(name, DiscriminatorColumnName, DiscriminatorAlias);
}
示例3: AppendIdentifierColumns
protected virtual void AppendIdentifierColumns(SelectFragment frag, string alias)
{
if (hasIdentifier)
{
frag.AddColumn(alias, identifierColumnName, identifierColumnAlias);
}
}
开发者ID:khaliyo,项目名称:Spring.net-NHibernate.net-Asp.net-MVC-DWZ-,代码行数:7,代码来源:AbstractCollectionPersister.cs
示例4: GenerateSelectFragment
protected override SelectFragment GenerateSelectFragment(string alias, string columnSuffix)
{
/*
NH-1747 FIX
Note: the fix for NH-1747 may cause some problem when the same ColumnName is used to represent two different properties in the same hierarchy
In all our test it happened only for NHibernate.Test.Legacy.MultiTableTest.MultiTableCollections
The mapping Multi.hbm.xml had a column named "parent" to represent the Key of a set for the relation Lower->Top and SubMulti->SubMulti everything in the same hierarchy
NH TODO: Have to add an early check of same ColumnName used to represent two relations.
*/
var ojl = (IOuterJoinLoadable)ElementPersister;
var selectFragment = new SelectFragment(Dialect).SetSuffix(columnSuffix);
var columnNames = KeyColumnNames;
var columnAliases = KeyColumnAliases;
for (int i = 0; i < columnNames.Length; i++)
{
var column = columnNames[i];
var tableAlias = ojl.GenerateTableAliasForColumn(alias, column);
selectFragment.AddColumn(tableAlias, column, columnAliases[i]);
}
return selectFragment;
}
示例5: ConcretePropertySelectFragment
// TODO NH: should remove duplication between this and the other overload,
// probably using H3 approach (adding indirection through IInclusionChecker interface).
protected string ConcretePropertySelectFragment(string alias, ValueInclusion[] inclusions)
{
int propertyCount = entityMetamodel.PropertySpan;
int[] propertyTableNumbers = PropertyTableNumbersInSelect;
SelectFragment frag = new SelectFragment(Factory.Dialect);
for (int i = 0; i < propertyCount; i++)
{
if (inclusions[i] != ValueInclusion.None)
{
//ie. updateable, not a formula
frag.AddColumns(
GenerateTableAlias(alias, propertyTableNumbers[i]),
propertyColumnNames[i],
propertyColumnAliases[i]
);
frag.AddFormulas(
GenerateTableAlias(alias, propertyTableNumbers[i]),
propertyColumnFormulaTemplates[i],
propertyColumnAliases[i]
);
}
}
return frag.ToSqlStringFragment();
}
示例6: AppendIndexColumns
protected virtual void AppendIndexColumns(SelectFragment frag, string alias)
{
if (hasIndex)
{
for (int i = 0; i < indexColumnIsSettable.Length; i++)
{
if (indexColumnIsSettable[i])
{
frag.AddColumn(alias, indexColumnNames[i], indexColumnAliases[i]);
}
else
{
frag.AddFormula(alias, indexFormulaTemplates[i], indexColumnAliases[i]);
}
}
}
}
开发者ID:khaliyo,项目名称:Spring.net-NHibernate.net-Asp.net-MVC-DWZ-,代码行数:17,代码来源:AbstractCollectionPersister.cs
示例7: AddDiscriminatorToSelect
protected override void AddDiscriminatorToSelect(SelectFragment select, string name, string suffix)
{
select.AddColumn(name, DiscriminatorColumnName, DiscriminatorAlias);
}
示例8: ConcretePropertySelectFragment
protected string ConcretePropertySelectFragment(string alias, IInclusionChecker inclusionChecker)
{
int propertyCount = PropertyNames.Length;
int[] propertyTableNumbers = PropertyTableNumbersInSelect;
SelectFragment frag = new SelectFragment(Factory.Dialect);
for (int i = 0; i < propertyCount; i++)
{
if (inclusionChecker.IncludeProperty(i))
{
frag.AddColumns(GenerateTableAlias(alias, propertyTableNumbers[i]), propertyColumnNames[i], propertyColumnAliases[i]);
frag.AddFormulas(GenerateTableAlias(alias, propertyTableNumbers[i]), propertyColumnFormulaTemplates[i], propertyColumnAliases[i]);
}
}
return frag.ToFragmentString();
}
示例9: GenerateSelectFragment
protected virtual SelectFragment GenerateSelectFragment(string alias, string columnSuffix)
{
SelectFragment frag = new SelectFragment(dialect)
.SetSuffix(columnSuffix)
.AddColumns(alias, keyColumnNames, keyColumnAliases);
return frag;
}
示例10: AppendIndexColumns
protected virtual void AppendIndexColumns(SelectFragment frag, string alias)
{
if (hasIndex)
{
frag.AddColumns(alias, indexColumnNames, indexColumnAliases);
}
}
示例11: PropertySelectFragment
public override SqlString PropertySelectFragment( string alias, string suffix )
{
SelectFragment frag = new SelectFragment( factory.Dialect )
.SetSuffix( suffix )
.SetUsedAliases( IdentifierAliases );
for( int i = 0; i < subclassColumnClosure.Length; i++ )
{
string subalias = Alias( alias, subclassColumnTableNumberClosure[ i ] );
frag.AddColumn( subalias, subclassColumnClosure[ i ], subclassColumnClosureAliases[ i ] );
}
for( int i = 0; i < subclassFormulaTemplateClosure.Length; i++ )
{
string subalias = Alias( alias, subclassFormulaTableNumberClosure[ i ] );
frag.AddFormula( subalias, subclassFormulaTemplateClosure[ i ], subclassFormulaAliasClosure[ i ] );
}
if( HasSubclasses )
{
SqlStringBuilder builder = new SqlStringBuilder( 3 );
builder.Add( StringHelper.CommaSpace );
builder.Add(
DiscriminatorFragment( alias )
.SetReturnColumnName( DiscriminatorAlias, suffix )
.ToSqlStringFragment()
);
builder.Add( frag.ToSqlStringFragment() );
return builder.ToSqlString();
}
else
{
return frag.ToSqlStringFragment();
}
}
示例12: ConcretePropertySelectFragment
private SqlString ConcretePropertySelectFragment( string alias, bool[] includeProperty )
{
int propertyCount = propertyColumnNames.Length;
SelectFragment frag = new SelectFragment( Dialect );
for( int i = 0; i < propertyCount; i++ )
{
if( includeProperty[ i ] )
{
frag.AddColumns(
Alias( alias, propertyTables[ i ] ),
propertyColumnNames[ i ],
propertyColumnNameAliases[ i ] );
}
}
return frag.ToSqlStringFragment( );
}
示例13: SelectFragment
public SqlString SelectFragment( string alias )
{
SelectFragment frag = new SelectFragment( dialect )
.SetSuffix( String.Empty ) //always ignore suffix for collection columns
.AddColumns( alias, keyColumnNames, keyColumnAliases )
.AddColumns( alias, elementColumnNames, elementColumnAliases );
if( hasIndex )
{
frag.AddColumns( alias, indexColumnNames, indexColumnAliases );
}
if( hasIdentifier )
{
frag.AddColumn( alias, identifierColumnName, identifierColumnAlias );
}
return frag.ToSqlStringFragment( false );
}
示例14: AddDiscriminatorToSelect
protected virtual void AddDiscriminatorToSelect(SelectFragment select, string name, string suffix) { }
示例15: AddDiscriminatorToSelect
protected override void AddDiscriminatorToSelect(SelectFragment select, string name, string suffix)
{
if (HasSubclasses)
{
select.SetExtraSelectList(DiscriminatorFragment(name), DiscriminatorAlias);
}
}