c# - mapping dto to entities? maybe automapper? should properties match? linq selection -
i trying create linq-to-sql solution using call basic linq-to-sql. not full orm solution via ef or that. point right leverage power of linq , reduce stored procedures (as other benefits).
i have done work dtos , entities before... custom implementation. in implementation automapper used. know automapper "works best" when entitiy properties match dto properties. if don't? can configure in custom way?
i suppose bigger question is... real solution fact cannot instantiate "linq-mapped" "entities" in query. clear cannot use linq , select new "entity" have select unmapped dto. trying avoid "mapping" entity dto in given query. suppose not big of deal automapper solve problem?
i'm not sure you're asking but:
i know automapper "works best" when entitiy properties match dto properties. if don't? can configure in custom way?
if you're asking think you're asking should .formember , overriding convert function. there examples of both on wiki: .formember: https://github.com/automapper/automapper/wiki/projection convert: https://github.com/automapper/automapper/wiki/custom-type-converters
automapper work "best" when dtos , entities match because it's super easy set map between 2 property names , types match. when don't match need manually select properties .formember or manually whole conversion overriding convert function.
i hope little helpful. pop comment below if wasn't or need more info.
Comments
Post a Comment