Comments (3)
I use automapper which works really well with .NET Core. I am in a rush at the moment, so will try to post an example soon.
But if you search for automapper and .NET Core, that might get you started
from dataaccess_aspnetcore_deprecated.
If you use our generic repositories you can use AutoMapper or an equivalent library to easily copy only the needed fields to a new DTO object, like @davidsheardown said. It's always better to not expose your entities to the client but to copy the data to a DTO object first. Downside to using our generic repositories for this is that you retrieve more fields from the database than the client needs.
If you really only want to retrieve the needed fields from the database, you will have to return a projection with a custom LINQ to Entities query where you only request the needed fields. You will have to make a custom repository for that.
from dataaccess_aspnetcore_deprecated.
I started using AutoMapper .
Thanks for help.
from dataaccess_aspnetcore_deprecated.
Related Issues (20)
- How to work fine with IdentityDbContext HOT 7
- Why i have to use migrations in MVC project and Stick with a routine
- Reason of IUnitOfWork and UnitOfWork HOT 1
- for Paging how to get record count HOT 1
- Inherited Entity HOT 1
- Update/Delete/Insert in a bulk HOT 2
- Include with filter HOT 1
- Using several connectionstring HOT 2
- error CS1061 DbContextOptionsBuilder HOT 3
- Another way to write HOT 1
- One to many update HOT 4
- Using identity
- EntityBase location
- Update to Core 2.0 HOT 6
- Readme.md uses "IncludeList" in its examples.
- Recursive/Hierarchical query
- Example for custom repository
- DivideByZeroException when PageLength equals 0
- Unable to create an object of type 'SampleAppContext'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dataaccess_aspnetcore_deprecated.