public PolymorphDatabaseAttribute(Type typeRegisterType)
        {
            PropertyInfo propertyInfo = typeRegisterType.GetProperty(INSTANCE_VARIABLE_NAME, INSTANCE_VARIABLE_LOOKUP_BINDING_FLAGS);

            if (propertyInfo == null)
            {
                return;
            }
            this.TypeRegister = (IModelTypeRegister)propertyInfo.GetValue(null);
        }
Пример #2
0
        public DatabasePersister(IDatabaseBase database)
        {
            this.database = database;

            PolymorphDatabaseAttribute polymorphAttr = database.GetType().GetCustomAttribute <PolymorphDatabaseAttribute>();

            if (polymorphAttr != null)
            {
                isPolymorph  = true;
                typeRegister = polymorphAttr.TypeRegister;
            }

            XmlTagNamesAttribute tagNameAttr = database.GetType().GetCustomAttribute <XmlTagNamesAttribute>();

            if (tagNameAttr != null)
            {
                rootTag = tagNameAttr.RootTag;
                itemTag = tagNameAttr.ItemTag;
            }
        }