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); }
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)); }
public virtual TEntity GetByID(object id) { return(_entitySet.Find(id)); }
public T Find(string Id) { return(dbSet.Find(Id)); }
public TEntity FindOne(int id) { return(_dbSet.Find(id)); }