public long GetNextSequence(ITypeInfo typeInfo, string prefix) { if (typeInfo == null) { throw new ArgumentNullException("typeInfo"); } return(GetNextSequence(XpoTypesInfoHelper.GetXpoTypeInfoSource().XPDictionary.GetClassInfo(typeInfo.Type), prefix)); }
public static void SetNextSequence(ITypeInfo typeInfo, string prefix, long nextId) { if (_sequenceGenerator == null) _sequenceGenerator = new SequenceGenerator(); var objectByKey = _sequenceGenerator._explicitUnitOfWork.FindObject(_sequenceObjectType, GetCriteria(typeInfo.FullName,prefix), true); _sequenceGenerator._sequence = objectByKey != null ? (ISequenceObject)objectByKey : CreateSequenceObject(prefix + typeInfo.FullName, _sequenceGenerator._explicitUnitOfWork); _sequenceGenerator._sequence.NextSequence = nextId; _sequenceGenerator._explicitUnitOfWork.FlushChanges(); _sequenceGenerator.Accept(); }
private static bool IsMySql(ITypeInfo typeInfo) { var sequenceObjectObjectSpaceProvider = GetSequenceObjectObjectSpaceProvider(typeInfo.Type); if (sequenceObjectObjectSpaceProvider != null) { var helper = new ConnectionStringParser(sequenceObjectObjectSpaceProvider.ConnectionString); string providerType = helper.GetPartByName(DataStoreBase.XpoProviderTypeParameterName); return(providerType == MySqlConnectionProvider.XpoProviderTypeString); } return(false); }
public static void SetNextSequence(ITypeInfo typeInfo, string prefix, long nextId) { if (_sequenceGenerator == null) { _sequenceGenerator = new SequenceGenerator(); } var objectByKey = _sequenceGenerator._explicitUnitOfWork.FindObject(_sequenceObjectType, GetCriteria(typeInfo.FullName, prefix), true); _sequenceGenerator._sequence = objectByKey != null ? (ISequenceObject)objectByKey : CreateSequenceObject(prefix + typeInfo.FullName, _sequenceGenerator._explicitUnitOfWork); _sequenceGenerator._sequence.NextSequence = nextId; _sequenceGenerator._explicitUnitOfWork.FlushChanges(); _sequenceGenerator.Accept(); }
public static void SetNextSequence(ITypeInfo typeInfo, long nextId) { SetNextSequence(typeInfo, null, nextId); }
public static void GenerateSequence(ISupportSequenceObject supportSequenceObject, ITypeInfo typeInfo) { if (_defaultDataLayer == null) { return; } if (supportSequenceObject.Session is NestedUnitOfWork || !supportSequenceObject.Session.IsNewObject(supportSequenceObject)) { return; } if (_sequenceGenerator == null) { _sequenceGenerator = new SequenceGenerator(); } long nextSequence = _sequenceGenerator.GetNextSequence(typeInfo, supportSequenceObject.Prefix); Session session = supportSequenceObject.Session; if (IsNotNestedUnitOfWork(session)) { SessionManipulationEventHandler[] sessionOnAfterCommitTransaction = { null }; sessionOnAfterCommitTransaction[0] = (sender, args) => { if (_sequenceGenerator != null) { try { _sequenceGenerator.Accept(); } finally { session.AfterCommitTransaction -= sessionOnAfterCommitTransaction[0]; } } }; session.AfterCommitTransaction += sessionOnAfterCommitTransaction[0]; } supportSequenceObject.Sequence = nextSequence; }
public static long GetNowSequence(ITypeInfo typeInfo) { var xpClassInfo = XpandModuleBase.Dictiorary.GetClassInfo(typeInfo.Type); return(GetNowSequence(xpClassInfo, null)); }
public long GetNextSequence(ITypeInfo typeInfo) { return(GetNextSequence(typeInfo, null)); }
public long GetNextSequence(ITypeInfo typeInfo) { return GetNextSequence(typeInfo, null); }
public long GetNextSequence(ITypeInfo typeInfo, string prefix) { if (typeInfo == null) throw new ArgumentNullException("typeInfo"); return GetNextSequence(XpoTypesInfoHelper.GetXpoTypeInfoSource().XPDictionary.GetClassInfo(typeInfo.Type), prefix); }
private static bool IsMySql(ITypeInfo typeInfo) { var sequenceObjectObjectSpaceProvider = GetSequenceObjectObjectSpaceProvider(typeInfo.Type); if (sequenceObjectObjectSpaceProvider != null) { var helper = new ConnectionStringParser(sequenceObjectObjectSpaceProvider.ConnectionString); string providerType = helper.GetPartByName(DataStoreBase.XpoProviderTypeParameterName); return providerType == MySqlConnectionProvider.XpoProviderTypeString; } return false; }
public static void GenerateSequence(ISupportSequenceObject supportSequenceObject, ITypeInfo typeInfo) { if (_defaultDataLayer == null) return; if (supportSequenceObject.Session is NestedUnitOfWork || !supportSequenceObject.Session.IsNewObject(supportSequenceObject)) return; if (_sequenceGenerator == null) _sequenceGenerator = new SequenceGenerator(); long nextSequence = _sequenceGenerator.GetNextSequence(typeInfo, supportSequenceObject.Prefix); Session session = supportSequenceObject.Session; if (IsNotNestedUnitOfWork(session)) { SessionManipulationEventHandler[] sessionOnAfterCommitTransaction = { null }; sessionOnAfterCommitTransaction[0] = (sender, args) => { if (_sequenceGenerator != null) { try { _sequenceGenerator.Accept(); } finally { session.AfterCommitTransaction -= sessionOnAfterCommitTransaction[0]; } } }; session.AfterCommitTransaction += sessionOnAfterCommitTransaction[0]; } supportSequenceObject.Sequence = nextSequence; }
public static long GetNowSequence(ITypeInfo typeInfo){ var xpClassInfo = XpandModuleBase.Dictiorary.GetClassInfo(typeInfo.Type); return GetNowSequence(xpClassInfo,null); }