dto

What is the best practice for sending data to the client: POCO or DTO?

爷,独闯天下 提交于 2019-11-27 01:53:27
问题 I'm starting a project using EF 4 and POCO. What is the best practice for sending data to the client ? Should I send the POCO or I should have a DTO instead? Are there any issue I should be aware of when sending the entity (that is disconnected from the context) to the client ? Is it a recommended practice to send the POCO to the client layer? 回答1: For me, one of the main reasons to use EF4 with POCO is the fact that you don't need DTO's. I can understand using DTO's with traditional EDMX

LINQ to map a datatable into a list<MyObject>

有些话、适合烂在心里 提交于 2019-11-27 01:29:35
问题 I just discover LINQ so be comprehensive with me please! :-) So! I have a Data-tier who provide me datatables and i want to convert them into lists of objects. These objects are defined in a spécific layer DTO (Data transfer Objects). How can I map every rows of my datatable into objects and put the all objects into a list? (today i make it "manually" field after field) Is it possible with LINQ? I've heard about LINQ2Entities? am i right? Thanks to help a beginner to understand... 回答1: If the

Best Practices For Mapping DTO to Domain Object?

蹲街弑〆低调 提交于 2019-11-26 23:39:49
I've seen a lot of questions related to mapping DTOs to Domain Objects, but I didn't feel they answered my question. I've used many methods before and have my own opinions but I'm looking for something a little more concrete. The Situation: We have many domain objects. We are using a CSLA model so our domain objects can be pretty complex and they contain their own data access. You do not want to pass these around on the wire. We are going to be writing some new services that will return data in a number of formats (.Net, JSON, etc.). For this (and other reasons) we are also creating a lean,

How to use DTO in JSF + Spring + Hibernate

隐身守侯 提交于 2019-11-26 23:10:57
问题 Assuming that i'm new about the topic DTO. I can't understand if it is correct to use the DTO in tandem with JSF, Spring and Hibernate. Let me explain, so far I have used the entity bean, created directly from the database, both in business layer and in the presentation layer. Now I decided to try using the DTO approach, but I can not understand how they can help. For example if I have two classes User and Message, and a user has more messages associated; how can I populate the DTO from the

DTO

▼魔方 西西 提交于 2019-11-26 21:04:43
1、领域模型变更,不影响UI。 2、没有业务逻辑,更加安全。 3、粗粒度设计,减少调用次数(网络往返)。 4、DTO参数方便扩展,不影响方法签名。 5、客户端使用简单明了、服务端设计明显清晰。 6、DataAnnotation可植入DTO,以简单验证。 7..... 转载于:https://www.cnblogs.com/ToughGuy/p/4555399.html 来源: https://blog.csdn.net/weixin_30855761/article/details/99121335

abp(net core)+easyui+efcore实现仓储管理系统——ABP WebAPI与EasyUI结合增删改查之二(二十八)

一世执手 提交于 2019-11-26 19:01:34
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+easyui+efcore实现仓储管理系统——解决方案介绍(二) abp(net core)+easyui+efcore实现仓储管理系统——领域层创建实体(三) abp(net core)+easyui+efcore实现仓储管理系统——定义仓储并实现 (四) abp(net core)+easyui+efcore实现仓储管理系统——创建应用服务(五) abp(net core)+easyui+efcore实现仓储管理系统——展现层实现增删改查之控制器(六) abp(net core)+easyui+efcore实现仓储管理系统——展现层实现增删改查之列表视图(七) abp(net core)+easyui+efcore实现仓储管理系统——展现层实现增删改查之增删改视图(八) abp(net core)+easyui+efcore实现仓储管理系统——展现层实现增删改查之菜单与测试(九) abp(net core)+easyui+efcore实现仓储管理系统——多语言(十) abp(net core)+easyui+efcore实现仓储管理系统——使用 WEBAPI实现CURD (十一)

DTO = ViewModel?

為{幸葍}努か 提交于 2019-11-26 18:49:22
问题 I'm using NHibernate to persist my domain objects. To keep things simple I'm using an ASP.NET MVC project as both my presentation layer, and my service layer. I want to return my domain objects in XML from my controller classes. After reading some posts here on Stack Overflow I gather DTOs are the way to go. However, I've also come across posts talking about the ViewModel. My question: Are Data Transfer Objects and ViewModels the same thing? Or is a ViewModel a kind of sub pattern of a DTO?

How to quickly check if two data transfer objects have equal properties in C#?

心已入冬 提交于 2019-11-26 14:15:40
I have these data transfer objects: public class Report { public int Id { get; set; } public int ProjectId { get; set; } //and so on for many, many properties. } I don't want to write public bool areEqual(Report a, Report b) { if (a.Id != b.Id) return false; if (a.ProjectId != b.ProjectId) return false; //Repeat ad nauseum return true; } Is there a faster way to test if two object with only properties have the same values (something that doesn't require one line of code or one logical expression per property?) Switching to structs is not an option. How about some reflection, perhaps using

Why are data transfer objects (DTOs) an anti-pattern?

廉价感情. 提交于 2019-11-26 14:06:01
I've recently overheard people saying that data transfer objects (DTOs) are an anti-pattern . Why? What are the alternatives? KLE Some projects have all data twice . Once as domain objects, and once as data transfer objects. This duplication has a huge cost , so the architecture needs to get a huge benefit from this separation to be worth it. Gabe Moothart DTOs are not an anti-pattern. When you're sending some data across the wire (say, to an web page in an Ajax call), you want to be sure that you conserve bandwidth by only sending data that the destination will use. Also, often it is

Should the repository layer return data-transfer-objects (DTO)?

為{幸葍}努か 提交于 2019-11-26 12:56:31
问题 I have a repository layer that is responsible for my data-access, which is called by a service layer. The service layer returns DTOs which are serialized and sent over the wire. More often than not, services do little more than access a repository and return whatever the repository returns. But for that to work, the repository has to return an instance of that DTO. Otherwise, you would first have to map the data layer object that the repository returns to a DTO in the service layer and return