Code Monkey home page Code Monkey logo

.net-ef6-genericrepository's People

Contributors

ioab avatar mombrea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

.net-ef6-genericrepository's Issues

Update() shouldn't load existing entity

Since EF5+ automatically attaches an entity whenever it is marked as modified, your code:

TObject existing = await _context.Set<TObject>().FindAsync(key);
if (existing != null)
{
  _context.Entry(existing).CurrentValues.SetValues(updated);
  await _context.SaveChangesAsync();
}

should be updated to:

_context.Entry(updated).State = EntityState.Modified;
await _context.SaveChangesAsync();

This gives three huge advantages:
a) only one database trip
b) less resource load, because no need for loading the original entity
c) no need for specifying a key, hence no concrete type dependence and a true generic method

Please see this StackOverflow comment for further details.

DataContext class missing methods

Hi,
DataContext class are missing lots of methods which are implemented in that BaseService class like Set method, SaveChangesAsync..
Am I missing any reference dll?

where are there?

Return IQueryable

I am curious why you decided to go with returning list objects vs IQueryables? Without the ability to retrieve IQueryable objects don't you limit access to linq extensions such as Include.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.