dto

AutoMapper多个源映射到一个Dto

為{幸葍}努か 提交于 2019-12-03 09:30:35
AutoMapper多个源映射到一个Dto 首先要引入AutoMapper(我电脑用的8.0,9.0版本) 1. 定义源映射对象 Model如下: 实体Social /// <summary> /// 社会属性 /// </summary> public class Social { public int Age { get; set; } public bool IsMarried { get; set; } public string Name { get; set; } } 实体Physical /// <summary> /// 身体属性 /// </summary> public class Physical { public string Eye { get; set; } public string Mouth { get; set; } } PeopleDto public class PeopleDto { public string Eye { get; set; } public string Mouth { get; set; } public string Ear { get; set; } public int Age { get; set; } public bool IsMarried { get; set; } } 2. 映射配置 public

Is my ASP.NET MVC application structured properly?

旧巷老猫 提交于 2019-12-03 08:48:00
问题 I've been going through the tutorials (specifically ones using Linq-To-Entities) and I understand the basic concepts, however some things are giving me issues. The tutorials usually involve only simple models and forms that only utilize basic create, update and delete statements. Mine are a little more complicated, and I'm not sure I'm going about this the right way because when it comes time to handle the relationships of a half dozen database objects, the tutorials stop helping. For the

DTO to Entity Mapping Tool

断了今生、忘了曾经 提交于 2019-12-03 06:54:40
I have an entity class Person and its corresponding DTO class PersonDto . public class Person: Entity { public virtual string Name { get; set; } public virtual string Phone { get; set; } public virtual string Email { get; set; } public virtual Sex Sex { get; set; } public virtual Position Position { get; set; } public virtual Division Division { get; set; } public virtual Organization Organization { get; set; } } public class PersonDto: Dto { public string Name { get; set; } public string Phone { get; set; } public string Email { get; set; } public Guid SexId { get; set; } public Guid

ApiController vs ODataController when exposing DTOs

五迷三道 提交于 2019-12-03 05:45:43
问题 Can someone explain me when I should inherit my controller form ODataController vs ApiController ? The question is caused by the fact that results returned by ApiController can be filtered with OData query. If I apply QueraybleAttribute to contoller's methods, query is processed even if action returns IEnumerable . However without this attribute but with the call config.EnableQuerySupport() , query is processed only if method returns IQueryable . I think it is not consistent behavior. WebAPI

Has Chrome improperly implemented the dataTransfer object?

一世执手 提交于 2019-12-03 05:24:41
When I do this in dragstart event: e.dataTransfer.setData('text/plain', 'text'); e.dataTransfer.setData('text/html', 'html'); e.dataTransfer.setData('application/x-bookmark', 'bookmark'); and this in drop event: for (var i = 0; i < e.dataTransfer.types.length; i++) { var type = e.dataTransfer.types[i]; console.log(type + ":" + e.dataTransfer.getData(type)); } I was supposed to have: text/plain:text text/html:html application/x-bookmark:bookmark as what I got in FF, but actually I got: Text:text text/plain:text in Chrome. Where are those data gone? Does this mean chrome did not implement the

What Project Layer Should Screen DTO's Live In?

依然范特西╮ 提交于 2019-12-03 05:16:06
问题 I have a project where we use screen DTO's to encapsulate the data between the Service Layer and the Presentation Layer . In our case, the presentation layer is ASP.Net. The only classes that know about the DTO's are the service layer classes and the Pages/Controls that call these services and display the DTO's. The DTO's are almost always Page/Control specific so I feel they belong in the Presentation Layer, but that would mean the Service Layer would have to reference the Presentation Layer

Best Practice - Multi Layer Architecture and DTOs [closed]

跟風遠走 提交于 2019-12-03 05:07:00
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 3 years ago . After reading some of the Q/As here on stackoverflow, I am still confused about the correct implementation of DTOs in my web application. My current implementation is a (Java EE based) multi-tier architecture (with persistence, service and presentation layer) but with a

VO和DO的区别

馋奶兔 提交于 2019-12-03 04:21:24
阿里巴巴Java开发手册中的DO、DTO、BO、AO、VO、POJO定义 分层领域模型规约: DO( Data Object):与数据库表结构一一对应,通过DAO层向上传输数据源对象。 DTO( Data Transfer Object):数据传输对象,Service或Manager向外传输的对象。 BO( Business Object):业务对象。 由Service层输出的封装业务逻辑的对象。 AO( Application Object):应用对象。 在Web层与Service层之间抽象的复用对象模型,极为贴近展示层,复用度不高。 VO( View Object):显示层对象,通常是Web向模板渲染引擎层传输的对象。 POJO( Plain Ordinary Java Object):在本手册中, POJO专指只有setter/getter/toString的简单类,包括DO/DTO/BO/VO等。 Query:数据查询对象,各层接收上层的查询请求。 注意超过2个参数的查询封装,禁止使用Map类来传输。 领域模型命名规约: 数据对象:xxxDO,xxx即为数据表名。 数据传输对象:xxxDTO,xxx为业务领域相关的名称。 展示对象:xxxVO,xxx一般为网页名称。 POJO是DO/DTO/BO/VO的统称,禁止命名成xxxPOJO。 DO和VO的 区别:

When using DTOs, Automapper & Nhibernate reflecting changes in child collections of DTO in domain object being updated

对着背影说爱祢 提交于 2019-12-03 03:55:41
I'm not massively familiar with this design but I am hoping to get some guidance. I have a backend service that sends out DTOs to a WPF smart client. On the WPF smart client the user will change,delete and modify items and then the changes are sent back (client --> server). As an example, currently I am working on the Customer details form and the user has the ability to add,remove and change categories belonging to a customer in a datagrid. When the DTO is sent back to the server I would like to load in the domain object that is related to the ID in the DTO and apply the changes made on the

POCO's, DTO's, DLL's and Anaemic Domain Models

狂风中的少年 提交于 2019-12-03 03:23:30
问题 I was looking at the differences between POCO and DTO (It appears that POCO's are dto's with behaviour (methods?))and came across this article by Martin Fowler on the anaemic domain model. Through lack of understanding, I think I have created one of these anaemic domain models. In one of my applications I have my business domain entities defined in a 'dto' dll. They have a lot of properties with getter's and setter's and not much else. My business logic code (populate, calculate) is in