Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. var type = GetTypeFromAssembly(typeName, fullNameSpaceType);
  2. var instanceOfMyType = Activator.CreateInstance(type);
  3. ReadObject(instanceOfMyType.GetType().GetProperties(), instanceOfMyType, fullNameSpaceType);
  4. return instanceOfMyType;
  5.  
  6. var parameter = Expression.Parameter(typeof(TObject));
  7.  
  8. var condition =
  9. Expression.Lambda<Func<TObject, bool>>(
  10. Expression.Equal(
  11. Expression.Property(parameter, theEntity.GetType().GetProperty("Id").Name),
  12. Expression.Constant(id, typeof(TKey))
  13. ), parameter
  14. ).Compile();
  15.  
  16. var theObject = _unitOfWork.Set<TObject>().Where(condition).FirstOrDefault();
  17.  
  18. var theObject = _catalogService.CreateObjectInstance(catalog, "Cms.Spv.Entities");
  19. _catalogService.GetObjectById<Guid, theObject>(id, theObject);
  20.  
  21. var MiObjeto = context.Set<T>().Find(PK);
  22.  
  23. public abstract class MiClaseGenerica<T> : IMiClaseGenerica<T> where T : class
  24. {
  25. public T ObtenerPorId(long PK)
  26. {
  27. return context.Set<T>().Find(PK);
  28. }
  29. }
  30.  
  31. public interface IMiClaseGenerica<T> : IDisposable where T : class
  32. {
  33. T ObtenerPorId(long PK);
  34. }
  35.  
  36. return _unitOfWork.Set<IComun>().Where(x=> x.PropiedadComun==id).FirstOrDefault();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement