private void Initialize() { string appId = ApplicationHelper.ApplicationId; bool mutexResult = false; string typeName = String.Format("HibernateStorageProvider_{0}_{1}_{2}", appId, StorageId, typeof(T).AssemblyQualifiedName.GetHashCode().ToString()); if (typeName.Length > 255) { // limit the length of the mutex name to avoid exception typeName = typeName.Substring(0, 255); } mAppIdMutex = new Mutex(true, typeName, out mutexResult); if (!mutexResult) { throw new InitializationException("An other application with the specified application identifier is running."); } this.mDeviceId = HashGeneratorHelper.GetSHA256BasedValue(StorageId); CategoryPropertyItem pi = ConfigurationAccessHelper.GetCategoryPropertyByPath(StorageConfiguration.Settings.CategoryPropertyItems, String.Format("NHibernateProvider/KnownStorageIdsToReset/{0}", StorageId)); if (pi != null) { Reset(); } LoadAllocationTable(); }
/// <summary> /// Initializes a new instance of the <see cref="EntityVersion"/> class. /// </summary> /// <param name="deviceId">The device id.</param> public EntityVersion(string deviceId) { if (String.IsNullOrEmpty(deviceId)) { ThrowHelper.ThrowArgumentNullException("deviceId"); } this.versionDeviceId = HashGeneratorHelper.GetSHA256BasedValue(deviceId); }
/// <summary> /// Initializes the <see cref="HibernateStorageProvider<T>"/> class. /// </summary> static HibernateStorageProvider() { SYSTEM_ID = HashGeneratorHelper.GetSHA256BasedValue(ApplicationHelper.ApplicationId); CategoryPropertyItem configItem = ConfigurationAccessHelper.GetCategoryPropertyByPath(StorageConfiguration.Settings.CategoryPropertyItems, "NHibernateProvider/NHibernateStorages/Default"); if (configItem != null) { DEFAULT_SESSION_FACTORY = CreateEntityManagerFactory(configItem); } configItem = ConfigurationAccessHelper.GetCategoryPropertyByPath(StorageConfiguration.Settings.CategoryPropertyItems, "NHibernateProvider/NHibernateStorages/StorageSpecified"); if (configItem != null) { foreach (CategoryPropertyItem pi in configItem) { mSessionFactoriesForStorages.Add(configItem.Id, CreateEntityManagerFactory(configItem)); } } }
/// <summary> /// Initializes a new instance of the <see cref="EntityId"/> class. /// </summary> /// <param name="systemId">The system id.</param> /// <param name="deviceId">The device id.</param> /// <param name="id">The id.</param> public EntityId(long systemId, string deviceId, long id) : this(systemId, HashGeneratorHelper.GetSHA256BasedValue(deviceId), id) { }