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)); }
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); }
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); }
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); }
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); }