} // property RecipesUsedAsIngredient

    public CraftingComponent(long componentID)
    {
        ID = componentID;
        Crafting_Components component = ComponentGateway.CraftingComponentGetByComponentID(ID);
        if (component == null)
        {
            Name = "n/a";
            Description = "n/a";
        }
        else
        {
            Name = component.displayName;
            Description = component.displayDescription;
        }
    } // constructor
Esempio n. 2
0
    } // method GetAllComponents

    public static Crafting_Components CraftingComponentGetByComponentID(long objectID)
    {
        string cacheKey = "CraftingComponentByComponentID_" + objectID;
        Crafting_Components returnObject = HttpContext.Current.Cache[cacheKey] as Crafting_Components;
        if (returnObject == null)
        {
            using (RepopdataEntities myEntities = new RepopdataEntities())
            {
                returnObject = (from item in myEntities.Crafting_Components
                                where item.componentID == objectID
                                select item).FirstOrDefault();
                if (returnObject == null) { return null; }
                AppCaching.AddToCache(cacheKey, returnObject);
            } // using
        }// if
        return returnObject;
    } // method CraftingComponentGetByComponentID