/// <summary>
 /// Determines the entity from one of its fields
 /// </summary>
 public static System.Type GetEntityType(EntityMappingConstants entityType)
 {
     switch (entityType)
     {
     case EntityMappingConstants.ConfigSetting: return(typeof(Restrike.GitHubIntegration.EFDAL.Entity.ConfigSetting));
     }
     throw new Exception("Unknown entity type!");
 }
        /// <summary>
        /// Determines the entity from one of its fields
        /// </summary>
        public static System.Type GetEntityType(EntityMappingConstants entityType)
        {
            switch (entityType)
            {
            case EntityMappingConstants.Customer: return(typeof(Acme.TestProject.EFDAL.Entity.Customer));

            case EntityMappingConstants.Order: return(typeof(Acme.TestProject.EFDAL.Entity.Order));
            }
            throw new Exception("Unknown entity type!");
        }
Beispiel #3
0
        /// <summary>
        /// Determines the entity from one of its fields
        /// </summary>
        public static System.Type GetEntityType(EntityMappingConstants entityType)
        {
            switch (entityType)
            {
            case EntityMappingConstants.CanadaPostalCode: return(typeof(Gravitybox.GeoLocation.EFDAL.Entity.CanadaPostalCode));

            case EntityMappingConstants.City: return(typeof(Gravitybox.GeoLocation.EFDAL.Entity.City));

            case EntityMappingConstants.State: return(typeof(Gravitybox.GeoLocation.EFDAL.Entity.State));

            case EntityMappingConstants.Zip: return(typeof(Gravitybox.GeoLocation.EFDAL.Entity.Zip));
            }
            throw new Exception("Unknown entity type!");
        }
Beispiel #4
0
        /// <summary>
        /// Determines the entity from one of its fields
        /// </summary>
        public static System.Type GetEntityType(EntityMappingConstants entityType)
        {
            switch (entityType)
            {
            case EntityMappingConstants.Project: return(typeof(Acme.MultiTenant.EFDAL.Entity.Project));

            case EntityMappingConstants.ProjectFile: return(typeof(Acme.MultiTenant.EFDAL.Entity.ProjectFile));

            case EntityMappingConstants.ProjectType: return(typeof(Acme.MultiTenant.EFDAL.Entity.ProjectType));

            case EntityMappingConstants.TenantMaster: return(typeof(Acme.MultiTenant.EFDAL.Entity.TenantMaster));

            case EntityMappingConstants.UserAccount: return(typeof(Acme.MultiTenant.EFDAL.Entity.UserAccount));
            }
            throw new Exception("Unknown entity type!");
        }
        /// <summary />
        public static Guid GetNextSequentialGuid(EntityMappingConstants entity, string key)
        {
            if (string.IsNullOrEmpty(key))
            {
                throw new Exception("Invalid key");
            }

            lock (_seqCacheLock)
            {
                var k = entity.ToString() + "|" + key;
                if (!_sequentialIdGeneratorCache.ContainsKey(k))
                {
                    ResetSequentialGuid(entity, key, Guid.NewGuid());
                }
                return(_sequentialIdGeneratorCache[k].NewId());
            }
        }
        /// <summary />
        public static void ResetSequentialGuid(EntityMappingConstants entity, string key, Guid seed)
        {
            if (string.IsNullOrEmpty(key))
            {
                throw new Exception("Invalid key");
            }

            lock (_seqCacheLock)
            {
                var k = entity.ToString() + "|" + key;
                if (!_sequentialIdGeneratorCache.ContainsKey(k))
                {
                    _sequentialIdGeneratorCache.Add(k, new SequentialIdGenerator(seed));
                }
                else
                {
                    _sequentialIdGeneratorCache[k].LastValue = seed;
                }
            }
        }
		/// <summary>
		/// 
		/// </summary>
		public static Guid GetNextSequntialGuid(EntityMappingConstants entity, string key)
		{
			if (string.IsNullOrEmpty(key))
				throw new Exception("Invalid key");

			lock (_seqCacheLock)
			{
				var k = entity.ToString() + "|" + key;
				if (!_sequentialIdGeneratorCache.ContainsKey(k))
					ResetSequentialGuid(entity, key, Guid.NewGuid());
				return _sequentialIdGeneratorCache[k].NewId();
			}
		}
		/// <summary>
		/// 
		/// </summary>
		public static void ResetSequentialGuid(EntityMappingConstants entity, string key, Guid seed)
		{
			if (string.IsNullOrEmpty(key))
				throw new Exception("Invalid key");

			lock (_seqCacheLock)
			{
				var k = entity.ToString() + "|" + key;
				if (!_sequentialIdGeneratorCache.ContainsKey(k))
					_sequentialIdGeneratorCache.Add(k, new SequentialIdGenerator(seed));
				else
					_sequentialIdGeneratorCache[k].LastValue = seed;
			}

		}