예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var entity = new PostEntity();
            var fieldsType = typeof(PostEntity.MemberNames);
            var relationFields = fieldsType.GetFields();
            var manyToManyFields = relationFields.Where(f => f.Name.Contains("CollectionVia"));
            var oneToManyFields = relationFields.Except(manyToManyFields);

            {
                var fields = PostEntity.FieldsCustomProperties;
                rptFields.DataSource = fields;
                rptFields.DataBind();
            }
            {
                var relations = PostEntity.Relations.GetAllRelations();
                rptRelations.DataSource = relations;
                rptRelations.DataBind();
            }
            {
                var customProperties = PostEntity.CustomProperties;
                rptCustomProperties.DataSource = customProperties;
                rptCustomProperties.DataBind();
            }
            {
                rptOneToManyRelationFields.DataSource = oneToManyFields;
                rptOneToManyRelationFields.DataBind();
            }
            {
                rptManyToManyRelationFields.DataSource = manyToManyFields;
                rptManyToManyRelationFields.DataBind();
            }
        }
        /// <summary>Creates a new PostEntity instance but uses a special constructor which will set the Fields object of the new IEntity2 instance to the passed in fields object.</summary>
        /// <param name="fields">Populated IEntityFields2 object for the new IEntity2 to create</param>
        /// <returns>Fully created and populated (due to the IEntityFields2 object) IEntity2 object</returns>
        public override IEntity2 Create(IEntityFields2 fields)
        {
            IEntity2 toReturn = new PostEntity(fields);

            // __LLBLGENPRO_USER_CODE_REGION_START CreateNewPostUsingFields
            // __LLBLGENPRO_USER_CODE_REGION_END
            return toReturn;
        }
        /// <summary>Creates a new, empty PostEntity object.</summary>
        /// <returns>A new, empty PostEntity object.</returns>
        public override IEntity2 Create()
        {
            IEntity2 toReturn = new PostEntity();

            // __LLBLGENPRO_USER_CODE_REGION_START CreateNewPost
            // __LLBLGENPRO_USER_CODE_REGION_END
            return toReturn;
        }
 /// <summary> setups the sync logic for member _post</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncPost(IEntity2 relatedEntity)
 {
     if(_post!=relatedEntity)
     {
         DesetupSyncPost(true, true);
         _post = (PostEntity)relatedEntity;
         base.PerformSetupSyncRelatedEntity( _post, new PropertyChangedEventHandler( OnPostPropertyChanged ), "Post", Category2PostEntity.Relations.PostEntityUsingFkPostId, true, new string[] {  } );
     }
 }
 /// <summary> Removes the sync logic for member _post</summary>
 /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param>
 /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param>
 private void DesetupSyncPost(bool signalRelatedEntity, bool resetFKFields)
 {
     base.PerformDesetupSyncRelatedEntity( _post, new PropertyChangedEventHandler( OnPostPropertyChanged ), "Post", Category2PostEntity.Relations.PostEntityUsingFkPostId, true, signalRelatedEntity, "Category2Post", resetFKFields, new int[] { (int)Category2PostFieldIndex.FkPostId } );
     _post = null;
 }
        /// <summary> Initializes the class members</summary>
        protected virtual void InitClassMembers()
        {
            _category2 = null;
            _post = null;

            PerformDependencyInjection();

            // __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers
            // __LLBLGENPRO_USER_CODE_REGION_END
            OnInitClassMembersComplete();
        }
        protected Category2PostEntity(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            if(SerializationHelper.Optimization != SerializationOptimization.Fast)
            {

                _category2 = (Category2Entity)info.GetValue("_category2", typeof(Category2Entity));
                if(_category2!=null)
                {
                    _category2.AfterSave+=new EventHandler(OnEntityAfterSave);
                }
                _post = (PostEntity)info.GetValue("_post", typeof(PostEntity));
                if(_post!=null)
                {
                    _post.AfterSave+=new EventHandler(OnEntityAfterSave);
                }

                base.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
            }

            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }