コード例 #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);
 }
コード例 #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);
        }
コード例 #3
0
 public T Get(int id)
 {
     return(dbSet.Find(id));
 }
コード例 #4
0
 public virtual TEntity GetByID(object id)
 {
     return(_entitySet.Find(id));
 }
コード例 #5
0
 public T Find(string Id)
 {
     return(dbSet.Find(Id));
 }
コード例 #6
0
ファイル: DataRepository.cs プロジェクト: CodeBagger/TxnFlow
 public TEntity FindOne(int id)
 {
     return(_dbSet.Find(id));
 }