Пример #1
0
 protected override void loadItemInfo(HibernateItem typeRow)
 {
     loadValue(typeRow, "type_id", out typeId);
     loadValue(typeRow, "type_namespace", out typeNamespace);
     loadValue(typeRow, "type_application_id", out applicationId);
     loadValue(typeRow, "type_primitive", out typeInheritsPrimitive);
     loadValue(typeRow, "type_likeable", out typeImplementsILikeable);
     loadValue(typeRow, "type_commentable", out typeImplementsICommentable);
     loadValue(typeRow, "type_rateable", out typeImplementsIRateable);
     loadValue(typeRow, "type_subscribeable", out typeImplementsISubscribeable);
     loadValue(typeRow, "type_shareable", out typeImplementsIShareable);
     loadValue(typeRow, "type_viewable", out typeImplementsIViewable);
     loadValue(typeRow, "type_notifiable", out typeImplementsINotifiable);
     loadValue(typeRow, "type_embeddable", out typeImplementsIEmbeddable);
 }
Пример #2
0
        internal ItemType(Core core, HibernateItem typeRow)
            : base(core)
        {
            ItemLoad += new ItemLoadHandler(ItemType_ItemLoad);

            try
            {
                loadItemInfo(typeRow);
            }
            catch (InvalidItemException)
            {
                throw new InvalidItemTypeException();
            }
        }
Пример #3
0
        private static ItemType updateItemTypeCache(Core core, long typeId)
        {
            ItemType typeItem = null;

            SelectQuery query = ItemType.GetSelectQueryStub(core, typeof(ItemType));
            query.AddCondition("type_id", typeId);

            System.Data.Common.DbDataReader typesReader = core.Db.ReaderQuery(query);

            if (typesReader.HasRows)
            {
                typesReader.Read();

                typeItem = new ItemType(core, typesReader);
                HibernateItem typeItemHibernate = new HibernateItem(typesReader);

                core.Cache.SetCached(string.Format("itemTypes[{0}]", typeItem.Id), typeItemHibernate, new TimeSpan(4, 0, 0), CacheItemPriority.NotRemovable);
                core.Cache.SetCached(string.Format("itemTypeIds[{0}]", typeItem.TypeNamespace), typeItem.Id, new TimeSpan(4, 0, 0), CacheItemPriority.NotRemovable);
                core.Cache.SetCached(string.Format("itemApplicationIds[{0}]", typeItem.Id), typeItem.ApplicationId, new TimeSpan(4, 0, 0), CacheItemPriority.NotRemovable);
            }

            typesReader.Close();
            typesReader.Dispose();

            return typeItem;
        }
Пример #4
0
        public static Dictionary<long, string> populateItemTypeCache(Core core)
        {
            if (core == null)
            {
                throw new NullCoreException();
            }

            Dictionary<long, string> primitiveTypes = new Dictionary<long, string>();

            object o = core.Cache.GetCached("itemPrimitiveTypes");

            if (o == null)
            {

                if (core.Cache != null)
                {
                    SelectQuery query = ItemType.GetSelectQueryStub(core, typeof(ItemType));

                    System.Data.Common.DbDataReader typesReader = null;

                    try
                    {
                        typesReader = core.Db.ReaderQuery(query);
                    }
                    catch
                    {
                        if (typesReader != null)
                        {
                            typesReader.Close();
                            typesReader.Dispose();
                        }

                        return primitiveTypes;
                    }

                    while (typesReader.Read())
                    {
                        ItemType typeItem = new ItemType(core, typesReader);
                        HibernateItem typeItemHibernate = new HibernateItem(typesReader);

                        core.Cache.SetCached(string.Format("itemTypes[{0}]", typeItem.Id), typeItemHibernate, new TimeSpan(4, 0, 0), CacheItemPriority.NotRemovable);
                        core.Cache.SetCached(string.Format("itemTypeIds[{0}]", typeItem.TypeNamespace), typeItem.Id, new TimeSpan(4, 0, 0), CacheItemPriority.NotRemovable);
                        core.Cache.SetCached(string.Format("itemApplicationIds[{0}]", typeItem.Id), typeItem.ApplicationId, new TimeSpan(4, 0, 0), CacheItemPriority.NotRemovable);

                        if (typeItem.IsPrimitive)
                        {
                            primitiveTypes.Add(typeItem.Id, typeItem.TypeNamespace);
                        }
                    }

                    core.Cache.SetCached("itemPrimitiveTypes", primitiveTypes, new TimeSpan(4, 0, 0), CacheItemPriority.High);

                    typesReader.Close();
                    typesReader.Dispose();
                }
            }

            return primitiveTypes;
        }
Пример #5
0
        protected override void loadItemInfo(HibernateItem emoticonRow)
        {
            emoticonId = (long)emoticonRow["emoticon_id"];
            loadValue(emoticonRow, "emoticon_title", out title);
            loadValue(emoticonRow, "emoticon_code", out code);
            loadValue(emoticonRow, "emoticon_code_alt", out codeAlternate);
            loadValue(emoticonRow, "emoticon_file", out file);
            loadValue(emoticonRow, "emoticon_category", out category);
            loadValue(emoticonRow, "emoticon_order", out emoticonOrder);

            itemLoaded(emoticonRow);
            //core.ItemCache.RegisterItem((NumberedItem)this);
        }
Пример #6
0
        public Emoticon(Core core, HibernateItem emoticonRow)
            : base(core)
        {
            ItemLoad += new ItemLoadHandler(Emoticon_ItemLoad);

            try
            {
                loadItemInfo(emoticonRow);
            }
            catch (InvalidItemException)
            {
                throw new InvalidEmoticonException();
            }
        }