コード例 #1
0
        public Dictionary <string, object> EntityGet <TEntity>(int id, IEntity entity) where TEntity : IEntity
        {
            ApplicationPlatformContext <TEntity> ContextEntity = new ApplicationPlatformContext <TEntity>();

            ContextEntity.Initialized();
            EntityRepository <TEntity> repository = new EntityRepository <TEntity>(ContextEntity, entity, false);

            return(repository.FindOne(id));
        }
コード例 #2
0
        public void EntityRemove <TEntity>(int id, IEntity entity) where TEntity : IEntity
        {
            ApplicationPlatformContext <TEntity> ContextEntity = new ApplicationPlatformContext <TEntity>();

            ContextEntity.Initialized();
            EntityRepository <TEntity> repository = new EntityRepository <TEntity>(ContextEntity, entity, false);

            repository.Delete(id);
        }
コード例 #3
0
        public Dictionary <string, object> GetOneWithCondiction <TEntity>(IEntity entity, Condition condition) where TEntity : IEntity
        {
            //default set 1 result
            condition.AddLimit(1);
            ApplicationPlatformContext <TEntity> ContextEntity = new ApplicationPlatformContext <TEntity>();

            ContextEntity.Initialized();
            EntityRepository <TEntity>  repository = new EntityRepository <TEntity>(ContextEntity, entity, false);
            Dictionary <string, object> entityOut  = repository.FindOneByCondiction(entity, condition);

            return(entityOut);
        }
コード例 #4
0
        public List <TEntity> GetWithCondiction <TEntity>(TEntity entity, Condition condition) where TEntity : IEntity
        {
            ApplicationPlatformContext <TEntity> ContextEntity = new ApplicationPlatformContext <TEntity>();

            ContextEntity.Initialized();
            EntityRepository <TEntity> repository = new EntityRepository <TEntity>(ContextEntity, entity, false);
            List <string> entityJsonList          = repository.FindByCondiction(entity, condition);

            List <TEntity> entities = new List <TEntity>();

            foreach (string item in entityJsonList)
            {
                entity = (TEntity)entity.GetInstance();
                entity.SetDictionary(JsonHelper.ParseJSON(item));
                entities.Add(entity);
            }
            return(entities);
        }
コード例 #5
0
        public bool EntityUpdate <TEntity>(IEntity entity) where TEntity : IEntity
        {
            bool success = false;

            try
            {
                ApplicationPlatformContext <TEntity> ContextEntity = new ApplicationPlatformContext <TEntity>();
                ContextEntity.Initialized();
                EntityRepository <TEntity> repository = new EntityRepository <TEntity>(ContextEntity, entity, false);
                repository.Update(entity);
            }
            catch (SqliteException ex)
            {
                SqLiteExceptionHandler <SqliteException> error = new SqLiteExceptionHandler <SqliteException>(ex);
                LoggerHelper.LogConsole("Database Error : ");
                LoggerHelper.LogConsole("Description" + error.GetDescription());
                LoggerHelper.LogConsole("TrackTrace" + error.GetTrackTrace());
            }
            return(success);
        }