Exemplo n.º 1
0
 private TDestination GetMapping <TSource, TDestination>(TSource source, TDestination dest, System.Data.Entity.DbSet <TDestination> destDbSet) where TDestination : MappableEntity where TSource : IMappableDTO
 //private static TDestination GetMapping<TSource, TDestination>(TSource source, TDestination dest, IEnumerable<TDestination> destDbSet) where TDestination : MappableEntity where TSource : IMappableDTO
 {
     if (dest == null || source.MappingId != dest.MappingId)
     {
         if (source?.MappingId != null)
         {
             //dest = destDbSet.SingleOrDefault(x => x.MappingId == source.MappingId);
             dest = destDbSet.Find(source.MappingId);
             return(dest);
         }
         else
         {
             return(null);
         }
     }
     return(dest);
 }
Exemplo n.º 2
0
        private TDestination GetMapping <TSource, TDestination>(TSource source, System.Data.Entity.DbSet <TDestination> destDbSet) where TDestination : MappableEntity, new() where TSource : IMappableDTO
        //private static TDestination GetMapping<TSource, TDestination>(TSource source, IEnumerable<TDestination> destDbSet) where TDestination : MappableEntity, new() where TSource : IMappableDTO
        {
            //return GetMapping<TSource, TDestination, TDestination>(source, destDbSet);
            TDestination dest = null;

            if (source?.MappingId != null)
            {
                //dest = destDbSet.SingleOrDefault(x => x.MappingId == source.MappingId);
                dest = destDbSet.Find(source.MappingId);
            }

            if (dest == null)
            {
                dest = new TDestination();
                //DbContext.SaveChanges();
                //destDbSet.Add(dest);
            }

            return(dest);
        }
 public T Get(int id)
 {
     return(dbSet.Find(id));
 }
Exemplo n.º 4
0
 public virtual TEntity GetByID(object id)
 {
     return(_entitySet.Find(id));
 }
Exemplo n.º 5
0
 public T Find(string Id)
 {
     return(dbSet.Find(Id));
 }
Exemplo n.º 6
0
 public TEntity FindOne(int id)
 {
     return(_dbSet.Find(id));
 }