示例#1
0
 public static SoftFluent.Samples.GED.Document Load(System.Guid id)
 {
     if ((id.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
     {
         return(null);
     }
     SoftFluent.Samples.GED.Document          document    = new SoftFluent.Samples.GED.Document();
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.GED.Constants.SoftFluent_Samples_GEDStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "Document", "Load");
     persistence.AddParameter("@Id", id, CodeFluentPersistence.DefaultGuidValue);
     System.Data.IDataReader reader = null;
     try
     {
         reader = persistence.ExecuteReader();
         if ((reader.Read() == true))
         {
             document.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default);
             document.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
             return(document);
         }
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         persistence.CompleteCommand();
     }
     return(null);
 }
示例#2
0
 public static DigitalPicnik.Item LoadById(System.Guid id)
 {
     if ((id.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
     {
         return(null);
     }
     DigitalPicnik.Item item = new DigitalPicnik.Item();
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(DigitalPicnik.Constants.DigitalPicnikStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "Item", "LoadById");
     persistence.AddParameter("@Id", id, CodeFluentPersistence.DefaultGuidValue);
     System.Data.IDataReader reader = null;
     try
     {
         reader = persistence.ExecuteReader();
         if ((reader.Read() == true))
         {
             item.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default);
             item.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
             return(item);
         }
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         persistence.CompleteCommand();
     }
     return(null);
 }
示例#3
0
 public static SoftFluent.Samples.AspNetIdentity2.UserClaim LoadById(System.Guid id)
 {
     if ((id.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
     {
         return(null);
     }
     SoftFluent.Samples.AspNetIdentity2.UserClaim userClaim   = new SoftFluent.Samples.AspNetIdentity2.UserClaim();
     CodeFluent.Runtime.CodeFluentPersistence     persistence = CodeFluentContext.Get(SoftFluent.Samples.AspNetIdentity2.Constants.SoftFluent_Samples_AspNetIdentity2StoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "UserClaim", "LoadById");
     persistence.AddParameter("@Id", id, CodeFluentPersistence.DefaultGuidValue);
     System.Data.IDataReader reader = null;
     try
     {
         reader = persistence.ExecuteReader();
         if ((reader.Read() == true))
         {
             userClaim.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default);
             userClaim.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
             return(userClaim);
         }
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         persistence.CompleteCommand();
     }
     return(null);
 }
示例#4
0
 public static ModelCodeFluent.Vehicle LoadByVehicleId(System.Guid vehicleId)
 {
     if ((vehicleId.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
     {
         return(null);
     }
     ModelCodeFluent.Vehicle vehicle = new ModelCodeFluent.Vehicle();
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(ModelCodeFluent.Constants.ModelCodeFluentStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "Vehicle", "LoadByVehicleId");
     persistence.AddParameter("@VehicleId", vehicleId, CodeFluentPersistence.DefaultGuidValue);
     System.Data.IDataReader reader = null;
     try
     {
         reader = persistence.ExecuteReader();
         if ((reader.Read() == true))
         {
             vehicle.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default);
             vehicle.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
             return(vehicle);
         }
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         persistence.CompleteCommand();
     }
     return(null);
 }
示例#5
0
 public static ModelCodeFluent.Identity.UserLogin LoadById(System.Guid id)
 {
     if ((id.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
     {
         return(null);
     }
     ModelCodeFluent.Identity.UserLogin       userLogin   = new ModelCodeFluent.Identity.UserLogin();
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(ModelCodeFluent.Constants.ModelCodeFluentStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "UserLogin", "LoadById");
     persistence.AddParameter("@Id", id, CodeFluentPersistence.DefaultGuidValue);
     System.Data.IDataReader reader = null;
     try
     {
         reader = persistence.ExecuteReader();
         if ((reader.Read() == true))
         {
             userLogin.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default);
             userLogin.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
             return(userLogin);
         }
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         persistence.CompleteCommand();
     }
     return(null);
 }
示例#6
0
 public static SoftFluent.Samples.SignalR.Proxy.Customer Load(System.Guid id)
 {
     if ((id.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
     {
         return(null);
     }
     SoftFluent.Samples.SignalR.Proxy.Customer ret = SoftFluent.Samples.SignalR.Proxy.Customer.WcfClient.Current.Channel.Load(id);
     return(ret);
 }
示例#7
0
        private static SoftFluent.Samples.RedisCache.Category CacheLoadById(bool useCache, System.Guid id)
        {
            if ((id.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
            {
                return(null);
            }
            SoftFluent.Samples.RedisCache.Category category = null;
            string cacheKey = null;

            if ((useCache == true))
            {
                cacheKey = CodeFluent.Runtime.Caching.SimpleCacheManager.BuildCacheKey("b6b0a13b51906622a43903b7f403984a", id);
                category = SoftFluent.Samples.RedisCache.Caching.CacheManager0.Manager.Get("SoftFluent.Samples.RedisCache.Category", cacheKey) as SoftFluent.Samples.RedisCache.Category;
                if ((category != null))
                {
                    return(category);
                }
            }
            category = new SoftFluent.Samples.RedisCache.Category();
            CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.RedisCache.Constants.SoftFluent_Samples_RedisCacheStoreName).Persistence;
            persistence.CreateStoredProcedureCommand(null, "Category", "LoadById");
            persistence.AddParameter("@Id", id, CodeFluentPersistence.DefaultGuidValue);
            persistence.AddParameter("@Lcid", System.Threading.Thread.CurrentThread.CurrentUICulture.LCID, ((int)(1033)));
            System.Data.IDataReader reader = null;
            try
            {
                reader = persistence.ExecuteReader();
                if ((reader.Read() == true))
                {
                    category.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default);
                    category.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
                    if ((useCache == true))
                    {
                        SoftFluent.Samples.RedisCache.Caching.CacheManager0.Manager.Add("SoftFluent.Samples.RedisCache.Category", cacheKey, category, null);
                    }
                    return(category);
                }
            }
            finally
            {
                if ((reader != null))
                {
                    reader.Dispose();
                }
                persistence.CompleteCommand();
            }
            return(null);
        }
        private static SoftFluent.Samples.RedisCache.Product CacheLoadById(bool useCache, System.Guid id)
        {
            if ((id.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
            {
                return(null);
            }
            SoftFluent.Samples.RedisCache.Product product = null;
            string cacheKey = null;

            if ((useCache == true))
            {
                cacheKey = CodeFluent.Runtime.Caching.SimpleCacheManager.BuildCacheKey("96f79df7ee65805288ec849db001ded7", id);
                product  = SoftFluent.Samples.RedisCache.Caching.CacheManager1.Manager.Get("SoftFluent.Samples.RedisCache.Product", cacheKey) as SoftFluent.Samples.RedisCache.Product;
                if ((product != null))
                {
                    return(product);
                }
            }
            product = new SoftFluent.Samples.RedisCache.Product();
            CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.RedisCache.Constants.SoftFluent_Samples_RedisCacheStoreName).Persistence;
            persistence.CreateStoredProcedureCommand(null, "Product", "LoadById");
            persistence.AddParameter("@Id", id, CodeFluentPersistence.DefaultGuidValue);
            System.Data.IDataReader reader = null;
            try
            {
                reader = persistence.ExecuteReader();
                if ((reader.Read() == true))
                {
                    product.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default);
                    product.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
                    if ((useCache == true))
                    {
                        SoftFluent.Samples.RedisCache.Caching.CacheManager1.Manager.Add("SoftFluent.Samples.RedisCache.Product", cacheKey, product, null);
                    }
                    return(product);
                }
            }
            finally
            {
                if ((reader != null))
                {
                    reader.Dispose();
                }
                persistence.CompleteCommand();
            }
            return(null);
        }
示例#9
0
        public static bool IsByteArrayValidGuid(byte[] byteArray)
        {
            if (byteArray == null)
            {
                return(false);
            }

            try
            {
                var guid = new System.Guid(byteArray);
                return(!guid.Equals(System.Guid.Empty));
            }
            catch
            {
                return(false);
            }
        }
示例#10
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || this.GetType() != o.GetType())
            {
                return(false);
            }

            GlobalSession that = ( GlobalSession )o;

            if (!_sessionId.Equals(that._sessionId))
            {
                return(false);
            }
            return(_owner.Equals(that._owner));
        }
示例#11
0
    public AK.Wwise.TreeView.TreeViewItem GetItemByGuid(AK.Wwise.TreeView.TreeViewItem in_item, System.Guid in_guid)
    {
        var itemGuid = new System.Guid((in_item.DataContext as AkTreeInfo).Guid);

        if (itemGuid.Equals(in_guid))
        {
            return(in_item);
        }

        for (var i = 0; i < in_item.Items.Count; i++)
        {
            var item = GetItemByGuid(in_item.Items[i], in_guid);

            if (item != null)
            {
                return(item);
            }
        }

        return(null);
    }
        /// <summary>
        ///     Search for an ability in this Character by the Ability's ID.
        ///     Will return null if no such ability is found
        /// </summary>
        public AbilityData SearchAbility(Guid abilityId)
        {
            if (abilityId.Equals(Guid.Empty))
            {
                Debug.LogWarning("RpgCharacterData.Ability(Guid) was given an empty GUID!");
                return(null);
            }

            AbilityData foundAbility = null;

            foreach (AbilityData ability in this.appliedAbilities)
            {
                if (ability.Id.Equals(abilityId))
                {
                    foundAbility = ability;
                    break;
                }
            }

            return(foundAbility);
        }
        /// <summary>
        ///     Search for a stat in this Character by ID. Will return null if no such stat is found
        /// </summary>
        public StatData SearchStat(Guid statId)
        {
            if (statId.Equals(Guid.Empty))
            {
                Debug.LogWarning("RpgCharacterData.SearchStat(Guid) was given an empty GUID!");
                return(null);
            }

            StatData foundStat = null;

            foreach (StatData s in this.appliedStats)
            {
                if (s.Id.Equals(statId))
                {
                    foundStat = s;
                    break;
                }
            }

            return(foundStat);
        }
 public static SoftFluent.Samples.GED.Security.UserRole Load(System.Guid roleId, System.Guid userId)
 {
     if ((roleId.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
     {
         return(null);
     }
     if ((userId.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
     {
         return(null);
     }
     SoftFluent.Samples.GED.Security.UserRole userRole    = new SoftFluent.Samples.GED.Security.UserRole();
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.GED.Constants.SoftFluent_Samples_GEDStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "UserRole", "Load");
     persistence.AddParameter("@RoleId", roleId);
     persistence.AddParameter("@UserId", userId);
     System.Data.IDataReader reader = null;
     try
     {
         reader = persistence.ExecuteReader();
         if ((reader.Read() == true))
         {
             userRole.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default);
             userRole.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
             return(userRole);
         }
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         persistence.CompleteCommand();
     }
     return(null);
 }