コード例 #1
0
        public IEnumerable <TEntity> AddRange(IEnumerable <TEntity> entities)
        {
            long longId = this.Max <TEntity, long>(e => e.CacheId) + 1;

            Type         entityType = typeof(TEntity);
            PropertyInfo idProperty = GetIdProperty(entityType);

            foreach (TEntity entity in entities)
            {
                SetEntityKey(idProperty, entity, ref longId);
                MockEntityList.Add(entity);
            }
            return(MockEntityList.ToList());
        }
コード例 #2
0
        public TEntity Add(TEntity entity)
        {
            Type         entityType = entity.GetType();
            PropertyInfo idProperty = GetIdProperty(entityType);

            if (idProperty != null)
            {
                object  key   = idProperty.GetValue(entity);
                TEntity found = FindByKey(key);
                //if (found != null)
                //{
                //    throw new DbUpdateExceptionBase();
                //}
            }
            MockEntityList.Add(entity);
            return(entity);
        }