コード例 #1
0
        public static NeighborhoodBuilder GetByID(int NeighborhoodBuilderID, IEnumerable <string> includeList = null)
        {
            NeighborhoodBuilder obj = null;
            string key = cacheKeyPrefix + NeighborhoodBuilderID + GetCacheIncludeText(includeList);

            NeighborhoodBuilder tmpClass = null;

            if (Cache.IsEnabled)
            {
                if (Cache.IsEmptyCacheItem(key))
                {
                    return(null);
                }
                tmpClass = Cache[key] as NeighborhoodBuilder;
            }

            if (tmpClass != null)
            {
                obj = tmpClass;
            }
            else
            {
                using (Entities entity = new Entities())
                {
                    IQueryable <NeighborhoodBuilder> itemQuery = AddIncludes(entity.NeighborhoodBuilder, includeList);
                    obj = itemQuery.FirstOrDefault(n => n.NeighborhoodBuilderID == NeighborhoodBuilderID);
                }
                Cache.Store(key, obj);
            }

            return(obj);
        }
コード例 #2
0
 public NeighborhoodBuilder(NeighborhoodBuilder objectToCopy)
 {
     BuilderID             = objectToCopy.BuilderID;
     NeighborhoodBuilderID = objectToCopy.NeighborhoodBuilderID;
     NeighborhoodID        = objectToCopy.NeighborhoodID;
 }