本文整理汇总了C#中NHibernate.Engine.ExecuteUpdateResultCheckStyle类的典型用法代码示例。如果您正苦于以下问题:C# ExecuteUpdateResultCheckStyle类的具体用法?C# ExecuteUpdateResultCheckStyle怎么用?C# ExecuteUpdateResultCheckStyle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExecuteUpdateResultCheckStyle类属于NHibernate.Engine命名空间,在下文中一共展示了ExecuteUpdateResultCheckStyle类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AppropriateExpectation
public static IExpectation AppropriateExpectation(ExecuteUpdateResultCheckStyle style)
{
if (style == ExecuteUpdateResultCheckStyle.None)
{
return None;
}
else if (style == ExecuteUpdateResultCheckStyle.Count)
{
return Basic;
}
else
{
throw new HibernateException("unknown check style : " + style);
}
}
示例2: SetCustomSQLUpdate
public void SetCustomSQLUpdate(string sql, bool callable, ExecuteUpdateResultCheckStyle checkStyle)
{
customSQLUpdate = SqlString.Parse(sql);
customUpdateCallable = callable;
updateCheckStyle = checkStyle;
}
示例3: SetCustomSQLInsert
public void SetCustomSQLInsert(string sql, bool callable, ExecuteUpdateResultCheckStyle checkStyle)
{
customSQLInsert = SqlString.Parse(sql);
customInsertCallable = callable;
insertCheckStyle = checkStyle;
}
示例4: SingleTableEntityPersister
public SingleTableEntityPersister(PersistentClass persistentClass, ICacheConcurrencyStrategy cache,
ISessionFactoryImplementor factory, IMapping mapping)
: base(persistentClass, cache, factory)
{
#region CLASS + TABLE
joinSpan = persistentClass.JoinClosureSpan + 1;
qualifiedTableNames = new string[joinSpan];
isInverseTable = new bool[joinSpan];
isNullableTable = new bool[joinSpan];
keyColumnNames = new string[joinSpan][];
Table table = persistentClass.RootTable;
qualifiedTableNames[0] =
table.GetQualifiedName(factory.Dialect, factory.Settings.DefaultCatalogName, factory.Settings.DefaultSchemaName);
isInverseTable[0] = false;
isNullableTable[0] = false;
keyColumnNames[0] = IdentifierColumnNames;
cascadeDeleteEnabled = new bool[joinSpan];
// Custom sql
customSQLInsert = new SqlString[joinSpan];
customSQLUpdate = new SqlString[joinSpan];
customSQLDelete = new SqlString[joinSpan];
insertCallable = new bool[joinSpan];
updateCallable = new bool[joinSpan];
deleteCallable = new bool[joinSpan];
insertResultCheckStyles = new ExecuteUpdateResultCheckStyle[joinSpan];
updateResultCheckStyles = new ExecuteUpdateResultCheckStyle[joinSpan];
deleteResultCheckStyles = new ExecuteUpdateResultCheckStyle[joinSpan];
customSQLInsert[0] = persistentClass.CustomSQLInsert;
insertCallable[0] = customSQLInsert[0] != null && persistentClass.IsCustomInsertCallable;
insertResultCheckStyles[0] = persistentClass.CustomSQLInsertCheckStyle
?? ExecuteUpdateResultCheckStyle.DetermineDefault(customSQLInsert[0], insertCallable[0]);
customSQLUpdate[0] = persistentClass.CustomSQLUpdate;
updateCallable[0] = customSQLUpdate[0] != null && persistentClass.IsCustomUpdateCallable;
updateResultCheckStyles[0] = persistentClass.CustomSQLUpdateCheckStyle
?? ExecuteUpdateResultCheckStyle.DetermineDefault(customSQLUpdate[0], updateCallable[0]);
customSQLDelete[0] = persistentClass.CustomSQLDelete;
deleteCallable[0] = customSQLDelete[0] != null && persistentClass.IsCustomDeleteCallable;
deleteResultCheckStyles[0] = persistentClass.CustomSQLDeleteCheckStyle
?? ExecuteUpdateResultCheckStyle.DetermineDefault(customSQLDelete[0], deleteCallable[0]);
#endregion
#region JOINS
int j = 1;
foreach (Join join in persistentClass.JoinClosureIterator)
{
qualifiedTableNames[j] = join.Table.GetQualifiedName(factory.Dialect, factory.Settings.DefaultCatalogName, factory.Settings.DefaultSchemaName);
isInverseTable[j] = join.IsInverse;
isNullableTable[j] = join.IsOptional;
cascadeDeleteEnabled[j] = join.Key.IsCascadeDeleteEnabled && factory.Dialect.SupportsCascadeDelete;
customSQLInsert[j] = join.CustomSQLInsert;
insertCallable[j] = customSQLInsert[j] != null && join.IsCustomInsertCallable;
insertResultCheckStyles[j] = join.CustomSQLInsertCheckStyle
??
ExecuteUpdateResultCheckStyle.DetermineDefault(customSQLInsert[j], insertCallable[j]);
customSQLUpdate[j] = join.CustomSQLUpdate;
updateCallable[j] = customSQLUpdate[j] != null && join.IsCustomUpdateCallable;
updateResultCheckStyles[j] = join.CustomSQLUpdateCheckStyle
??
ExecuteUpdateResultCheckStyle.DetermineDefault(customSQLUpdate[j], updateCallable[j]);
customSQLDelete[j] = join.CustomSQLDelete;
deleteCallable[j] = customSQLDelete[j] != null && join.IsCustomDeleteCallable;
deleteResultCheckStyles[j] = join.CustomSQLDeleteCheckStyle
??
ExecuteUpdateResultCheckStyle.DetermineDefault(customSQLDelete[j], deleteCallable[j]);
IEnumerable<Column> enumerableKeyCol = new SafetyEnumerable<Column>(join.Key.ColumnIterator);
List<string> kcName = new List<string>(join.Key.ColumnSpan);
foreach (Column col in enumerableKeyCol)
kcName.Add(col.GetQuotedName(factory.Dialect));
keyColumnNames[j] = kcName.ToArray();
j++;
}
constraintOrderedTableNames = new string[qualifiedTableNames.Length];
constraintOrderedKeyColumnNames = new string[qualifiedTableNames.Length][];
for (int i = qualifiedTableNames.Length - 1, position = 0; i >= 0; i--, position++)
{
constraintOrderedTableNames[position] = qualifiedTableNames[i];
constraintOrderedKeyColumnNames[position] = keyColumnNames[i];
}
spaces = ArrayHelper.Join(qualifiedTableNames, ArrayHelper.ToStringArray(persistentClass.SynchronizedTables));
bool lazyAvailable = IsInstrumented(EntityMode.Poco);
bool hasDeferred = false;
List<string> subclassTables = new List<string>();
List<string[]> joinKeyColumns = new List<string[]>();
List<bool> isConcretes = new List<bool>();
List<bool> isDeferreds = new List<bool>();
List<bool> isInverses = new List<bool>();
List<bool> isNullables = new List<bool>();
List<bool> isLazies = new List<bool>();
//.........这里部分代码省略.........
示例5: SetCustomSQLDeleteAll
public void SetCustomSQLDeleteAll(string sql, bool callable, ExecuteUpdateResultCheckStyle checkStyle)
{
customSQLDeleteAll = SqlString.Parse(sql);
customDeleteAllCallable = callable;
deleteAllCheckStyle = checkStyle;
}
示例6: AbstractCollectionPersister
//.........这里部分代码省略.........
}
else
{
identityDelegate = null;
}
CheckColumnDuplication(distinctColumns, idColl.Identifier.ColumnIterator);
}
else
{
identifierType = null;
identifierColumnName = null;
identifierColumnAlias = null;
identifierGenerator = null;
identityDelegate = null;
}
#endregion
#region GENERATE THE SQL
// NH Different behavior : for the Insert SQL we are managing isPostInsertIdentifier (not supported in H3.2.5)
if (collection.CustomSQLInsert == null)
{
if (!IsIdentifierAssignedByInsert)
{
sqlInsertRowString = GenerateInsertRowString();
}
else
{
sqlInsertRowString = GenerateIdentityInsertRowString();
}
insertCallable = false;
insertCheckStyle = ExecuteUpdateResultCheckStyle.Count;
}
else
{
SqlType[] parmsTypes = GenerateInsertRowString().ParameterTypes;
sqlInsertRowString = new SqlCommandInfo(collection.CustomSQLInsert, parmsTypes);
insertCallable = collection.IsCustomInsertCallable;
insertCheckStyle = collection.CustomSQLInsertCheckStyle
?? ExecuteUpdateResultCheckStyle.DetermineDefault(collection.CustomSQLInsert, insertCallable);
}
sqlUpdateRowString = GenerateUpdateRowString();
if (collection.CustomSQLUpdate == null)
{
updateCallable = false;
updateCheckStyle = ExecuteUpdateResultCheckStyle.Count;
}
else
{
sqlUpdateRowString = new SqlCommandInfo(collection.CustomSQLUpdate, sqlUpdateRowString.ParameterTypes);
updateCallable = collection.IsCustomUpdateCallable;
updateCheckStyle = collection.CustomSQLUpdateCheckStyle
?? ExecuteUpdateResultCheckStyle.DetermineDefault(collection.CustomSQLUpdate, updateCallable);
}
sqlDeleteRowString = GenerateDeleteRowString();
if (collection.CustomSQLDelete == null)
{
deleteCallable = false;
deleteCheckStyle = ExecuteUpdateResultCheckStyle.None;
}
else
{
开发者ID:khaliyo,项目名称:Spring.net-NHibernate.net-Asp.net-MVC-DWZ-,代码行数:67,代码来源:AbstractCollectionPersister.cs
示例7: JoinedSubclassEntityPersister
//.........这里部分代码省略.........
foreach (Column column in tab.PrimaryKey.ColumnIterator)
key.Add(column.GetQuotedName(factory.Dialect));
keyColumns.Add(key.ToArray());
}
subclassTableNameClosure = subtables.ToArray();
subclassTableKeyColumnClosure = keyColumns.ToArray();
isClassOrSuperclassTable = isConcretes.ToArray();
constraintOrderedTableNames = new string[subclassTableNameClosure.Length];
constraintOrderedKeyColumnNames = new string[subclassTableNameClosure.Length][];
int currentPosition = 0;
for (int i = subclassTableNameClosure.Length - 1; i >= 0; i--, currentPosition++)
{
constraintOrderedTableNames[currentPosition] = subclassTableNameClosure[i];
constraintOrderedKeyColumnNames[currentPosition] = subclassTableKeyColumnClosure[i];
}
tableSpan = naturalOrderTableNames.Length;
tableNames = Reverse(naturalOrderTableNames);
tableKeyColumns = Reverse(naturalOrderTableKeyColumns);
Reverse(subclassTableNameClosure, tableSpan);
Reverse(subclassTableKeyColumnClosure, tableSpan);
spaces = ArrayHelper.Join(tableNames, persistentClass.SynchronizedTables.ToArray());
// Custom sql
customSQLInsert = new SqlString[tableSpan];
customSQLUpdate = new SqlString[tableSpan];
customSQLDelete = new SqlString[tableSpan];
insertCallable = new bool[tableSpan];
updateCallable = new bool[tableSpan];
deleteCallable = new bool[tableSpan];
insertResultCheckStyles = new ExecuteUpdateResultCheckStyle[tableSpan];
updateResultCheckStyles = new ExecuteUpdateResultCheckStyle[tableSpan];
deleteResultCheckStyles = new ExecuteUpdateResultCheckStyle[tableSpan];
PersistentClass pc = persistentClass;
int jk = tableSpan - 1;
while (pc != null)
{
customSQLInsert[jk] = pc.CustomSQLInsert;
insertCallable[jk] = customSQLInsert[jk] != null && pc.IsCustomInsertCallable;
insertResultCheckStyles[jk] = pc.CustomSQLInsertCheckStyle
??
ExecuteUpdateResultCheckStyle.DetermineDefault(customSQLInsert[jk], insertCallable[jk]);
customSQLUpdate[jk] = pc.CustomSQLUpdate;
updateCallable[jk] = customSQLUpdate[jk] != null && pc.IsCustomUpdateCallable;
updateResultCheckStyles[jk] = pc.CustomSQLUpdateCheckStyle
??
ExecuteUpdateResultCheckStyle.DetermineDefault(customSQLUpdate[jk], updateCallable[jk]);
customSQLDelete[jk] = pc.CustomSQLDelete;
deleteCallable[jk] = customSQLDelete[jk] != null && pc.IsCustomDeleteCallable;
deleteResultCheckStyles[jk] = pc.CustomSQLDeleteCheckStyle
??
ExecuteUpdateResultCheckStyle.DetermineDefault(customSQLDelete[jk], deleteCallable[jk]);
jk--;
pc = pc.Superclass;
}
if (jk != -1)
{
throw new AssertionFailure("Tablespan does not match height of joined-subclass hierarchy.");
}
#endregion
示例8: UnionSubclassEntityPersister
public UnionSubclassEntityPersister(PersistentClass persistentClass, ICacheConcurrencyStrategy cache,
ISessionFactoryImplementor factory, IMapping mapping):base(persistentClass, cache, factory)
{
if (IdentifierGenerator is IdentityGenerator)
{
throw new MappingException("Cannot use identity column key generation with <union-subclass> mapping for: " + EntityName);
}
// TABLE
tableName =
persistentClass.Table.GetQualifiedName(factory.Dialect, factory.Settings.DefaultCatalogName,
factory.Settings.DefaultSchemaName);
#region Custom SQL
SqlString sql;
bool callable;
ExecuteUpdateResultCheckStyle checkStyle;
sql = persistentClass.CustomSQLInsert;
callable = sql != null && persistentClass.IsCustomInsertCallable;
checkStyle = sql == null
? ExecuteUpdateResultCheckStyle.Count
: (persistentClass.CustomSQLInsertCheckStyle
?? ExecuteUpdateResultCheckStyle.DetermineDefault(sql, callable));
customSQLInsert = new SqlString[] { sql };
insertCallable = new bool[] { callable };
insertResultCheckStyles = new ExecuteUpdateResultCheckStyle[] { checkStyle };
sql = persistentClass.CustomSQLUpdate;
callable = sql != null && persistentClass.IsCustomUpdateCallable;
checkStyle = sql == null
? ExecuteUpdateResultCheckStyle.Count
: (persistentClass.CustomSQLUpdateCheckStyle
?? ExecuteUpdateResultCheckStyle.DetermineDefault(sql, callable));
customSQLUpdate = new SqlString[] { sql };
updateCallable = new bool[] { callable };
updateResultCheckStyles = new ExecuteUpdateResultCheckStyle[] { checkStyle };
sql = persistentClass.CustomSQLDelete;
callable = sql != null && persistentClass.IsCustomDeleteCallable;
checkStyle = sql == null
? ExecuteUpdateResultCheckStyle.Count
: (persistentClass.CustomSQLDeleteCheckStyle
?? ExecuteUpdateResultCheckStyle.DetermineDefault(sql, callable));
customSQLDelete = new SqlString[] { sql };
deleteCallable = new bool[] { callable };
deleteResultCheckStyles = new ExecuteUpdateResultCheckStyle[] { checkStyle };
#endregion
discriminatorValue = persistentClass.SubclassId;
discriminatorSQLValue = persistentClass.SubclassId.ToString();
#region PROPERTIES
int subclassSpan = persistentClass.SubclassSpan + 1;
subclassClosure = new string[subclassSpan];
subclassClosure[0] = EntityName;
#endregion
#region SUBCLASSES
subclassByDiscriminatorValue[persistentClass.SubclassId] = persistentClass.EntityName;
if (persistentClass.IsPolymorphic)
{
int k = 1;
foreach (Subclass sc in persistentClass.SubclassIterator)
{
subclassClosure[k++] = sc.EntityName;
subclassByDiscriminatorValue[sc.SubclassId] = sc.EntityName;
}
}
#endregion
#region SPACES
//TODO: i'm not sure, but perhaps we should exclude abstract denormalized tables?
int spacesSize = 1 + persistentClass.SynchronizedTables.Count;
spaces = new string[spacesSize];
spaces[0] = tableName;
IEnumerator<string> iSyncTab = persistentClass.SynchronizedTables.GetEnumerator();
for (int i = 1; i < spacesSize; i++)
{
iSyncTab.MoveNext();
spaces[i] = iSyncTab.Current;
}
HashedSet<string> subclassTables = new HashedSet<string>();
foreach (Table table in persistentClass.SubclassTableClosureIterator)
{
subclassTables.Add(
table.GetQualifiedName(factory.Dialect, factory.Settings.DefaultCatalogName, factory.Settings.DefaultSchemaName));
}
subclassSpaces = new string[subclassTables.Count];
subclassTables.CopyTo(subclassSpaces, 0);
//.........这里部分代码省略.........
示例9: AbstractCollectionPersister
//.........这里部分代码省略.........
if (hasIdentifier)
{
if (collection.IsOneToMany)
{
throw new MappingException("one-to-many collections with identifiers are not supported.");
}
IdentifierCollection idColl = (IdentifierCollection) collection;
identifierType = idColl.Identifier.Type;
Column col = null;
foreach (Column column in idColl.Identifier.ColumnCollection)
{
col = column;
break;
}
identifierColumnName = col.GetQuotedName(dialect);
identifierColumnAlias = alias.ToAliasString(col.GetAlias(dialect), dialect);
identifierGenerator = idColl.Identifier.CreateIdentifierGenerator(dialect);
CheckColumnDuplication(distinctColumns, idColl.Identifier.ColumnCollection);
}
else
{
identifierType = null;
identifierColumnName = null;
identifierColumnAlias = null;
identifierGenerator = null;
}
sqlInsertRowString = GenerateInsertRowString();
if (collection.CustomSQLInsert == null)
{
insertCallable = false;
insertCheckStyle = ExecuteUpdateResultCheckStyle.Count;
}
else
{
sqlInsertRowString = new SqlCommandInfo(collection.CustomSQLInsert, sqlInsertRowString.ParameterTypes);
insertCallable = collection.IsCustomInsertCallable;
insertCheckStyle = collection.CustomSQLInsertCheckStyle == null
? ExecuteUpdateResultCheckStyle.DetermineDefault(collection.CustomSQLInsert, insertCallable)
: collection.CustomSQLInsertCheckStyle;
}
sqlUpdateRowString = GenerateUpdateRowString();
if (collection.CustomSQLUpdate == null)
{
updateCallable = false;
updateCheckStyle = ExecuteUpdateResultCheckStyle.Count;
}
else
{
sqlUpdateRowString = new SqlCommandInfo(collection.CustomSQLUpdate, sqlUpdateRowString.ParameterTypes);
updateCallable = collection.IsCustomUpdateCallable;
updateCheckStyle = collection.CustomSQLUpdateCheckStyle == null
? ExecuteUpdateResultCheckStyle.DetermineDefault(collection.CustomSQLUpdate, updateCallable)
: collection.CustomSQLUpdateCheckStyle;
}
sqlDeleteRowString = GenerateDeleteRowString();
if (collection.CustomSQLDelete == null)
{
deleteCallable = false;
deleteCheckStyle = ExecuteUpdateResultCheckStyle.None;
}
else
示例10: SingleTableEntityPersister
//INITIALIZATION:
public SingleTableEntityPersister(PersistentClass model, ICacheConcurrencyStrategy cache,
ISessionFactoryImplementor factory, IMapping mapping)
: base(model, cache, factory)
{
// CLASS + TABLE
System.Type mappedClass = model.MappedClass;
Table table = model.RootTable;
qualifiedTableName = table.GetQualifiedName(Dialect, factory.DefaultSchema);
tableNames = new string[] {qualifiedTableName};
// Custom sql
customSQLInsert = new SqlString[1];
customSQLUpdate = new SqlString[1];
customSQLDelete = new SqlString[1];
insertCallable = new bool[1];
updateCallable = new bool[1];
deleteCallable = new bool[1];
insertResultCheckStyles = new ExecuteUpdateResultCheckStyle[1];
updateResultCheckStyles = new ExecuteUpdateResultCheckStyle[1];
deleteResultCheckStyles = new ExecuteUpdateResultCheckStyle[1];
customSQLInsert[0] = model.CustomSQLInsert;
insertCallable[0] = customSQLInsert[0] != null && model.IsCustomInsertCallable;
insertResultCheckStyles[0] = model.CustomSQLInsertCheckStyle == null
?
ExecuteUpdateResultCheckStyle.DetermineDefault(customSQLInsert[0], insertCallable[0])
: model.CustomSQLInsertCheckStyle;
customSQLUpdate[0] = model.CustomSQLUpdate;
updateCallable[0] = customSQLUpdate[0] != null && model.IsCustomUpdateCallable;
updateResultCheckStyles[0] = model.CustomSQLUpdateCheckStyle == null
?
ExecuteUpdateResultCheckStyle.DetermineDefault(customSQLUpdate[0], updateCallable[0])
: model.CustomSQLUpdateCheckStyle;
customSQLDelete[0] = model.CustomSQLDelete;
deleteCallable[0] = customSQLDelete[0] != null && model.IsCustomDeleteCallable;
deleteResultCheckStyles[0] = model.CustomSQLDeleteCheckStyle == null
?
ExecuteUpdateResultCheckStyle.DetermineDefault(customSQLDelete[0], deleteCallable[0])
: model.CustomSQLDeleteCheckStyle;
// detect mapping errors
HashedSet distinctColumns = new HashedSet();
// DISCRIMINATOR
if (model.IsPolymorphic)
{
IValue d = model.Discriminator;
if (d == null)
{
throw new MappingException("A discriminator mapping required for polymorphic persistence of " + model.Name);
}
forceDiscriminator = model.IsForceDiscriminator;
// the discriminator will have only one column
foreach (ISelectable selectable in d.ColumnCollection)
{
if (d.HasFormula)
{
Formula formula = (Formula) selectable;
discriminatorFormula = formula.FormulaString;
discriminatorFormulaTemplate = formula.GetTemplate(factory.Dialect, factory.SQLFunctionRegistry);
discriminatorColumnName = null;
discriminatorAlias = "clazz_";
}
else
{
Column column = (Column) selectable;
discriminatorColumnName = column.GetQuotedName(Dialect);
discriminatorAlias = column.GetAlias(Dialect);
discriminatorFormula = null;
discriminatorFormulaTemplate = null;
}
}
discriminatorType = model.Discriminator.Type;
if (model.IsDiscriminatorValueNull)
{
discriminatorValue = NullDiscriminator;
discriminatorSQLValue = InFragment.Null;
discriminatorInsertable = false;
}
else if (model.IsDiscriminatorValueNotNull)
{
discriminatorValue = NotNullDiscriminator;
discriminatorSQLValue = InFragment.NotNull;
discriminatorInsertable = false;
}
else
{
discriminatorInsertable = model.IsDiscriminatorInsertable && !d.HasFormula;
try
{
IDiscriminatorType dtype = (IDiscriminatorType) discriminatorType;
discriminatorValue = dtype.StringToObject(model.DiscriminatorValue);
discriminatorSQLValue = dtype.ObjectToSQLString(discriminatorValue);
}
catch (InvalidCastException)
//.........这里部分代码省略.........