示例#1
0
        public void Update(PK id, TParam param)
        {
            ValidateParametersSpecific(param, id);

            TEntity oldEntity = Dao.Find(id);
            TEntity newEntity = ParamConverter.Convert(param, oldEntity);

            Dao.Update(newEntity);
        }
示例#2
0
        public TResult Create(TParam param)
        {
            ValidateParametersStandart(param);
            ValidateParametersSpecific(param, default);

            TEntity entity = ParamConverter.Convert(param, null);

            Dao.Save(entity);

            return(ResultConverter.Convert(entity));
        }
示例#3
0
        public List <TResult> Create(List <TParam> param)
        {
            List <TEntity> entities = new List <TEntity>();

            param.ForEach(item => entities.Add(ParamConverter.Convert(item, null)));

            Dao.Save(entities);

            List <TResult> result = new List <TResult>();

            entities.ForEach(entity => result.Add(ResultConverter.Convert(entity)));

            return(result);
        }
示例#4
0
        public void Update(List <TParam> param)
        {
            List <TEntity> entities = new List <TEntity>();

            foreach (var item in param)
            {
                TEntity oldEntity = Dao.Find(GetPK(item));
                TEntity newEntity = ParamConverter.Convert(item, oldEntity);

                entities.Add(newEntity);
            }

            Dao.Update(entities);
        }