asp.net - What Project Layer Should Screen DTO's Live In? -


Text after "div class =" itemprop = "text">

I have a project where we use the screen to integrate data between DTO service layer And presentation layer In our case, the presentation layer is ASP.Net.

Only classrooms that know about DTO service layer sections and page / control that these services are displayed and displayed on DTO's.

DTO is almost always the page / control specific, so I think that they are in the presentation layer, but this would mean that the service layer command is used to refer to the presentation layer to use the DTO .

I am almost thinking that service layer should return richer objects (but domain entities?) And then the presentation layer takes these items and they map the map very specific for every page of DTO / concern for controlling Can be the subject of.

Here is an Interface declaration and you can see what I am talking about as a DTO:

Public Interface IBlogTasks {BlogPostDisplayDTO GetBlogEntryByTitleAndDate (integer year, Integer month, string urlFriendlyTitle); } Public class BlogPostDisplayDTO {public string title {receives; Set; } Public Date Time PostDate {Received; Set; } Public string HtmlContent {get; Set; } Public String ImageUrl {get; Set; } Public String Writer {get; Set; } Public entry CommentCount {get; Set; } Public string permelink {get; Set; }}

edit

Here is another code sample to describe in a case where the domain model is not included. Maybe it will make some things clear. I believe that I have overloaded the DTO meaning that I am not talking about DTO for the purpose of transferring an object to the wire. I am making DTO for formalizing the contract between communication at my service level.

  Public Interface IAuthenticationTasks {bool AuthenticateUser (AuthenticationFormDTO authDTO); } Public class authenticationfDTDO {public string username {receipt; Set; } Public string password {get; Set; } Public Bull continues {get} Set; }}  

Assume that all of my certifications suddenly need an IP address parameter. I can now add that property to DTO without changing my contract interface.

I do not want to pass my presentation layer to the institutions. I do not want my code to have the ability to go BlogPost.AddComment (new comment ())

Even thought that the use of utility-use cases for "DTO" are more "serial objects that can be crossed across the wire", in this case you can actually create 'presentation-transfer- Objects' or 'visual-model'

Usually, the answer to our projects is where it is located where 'translation' code is mapped to the DDD domain model in PDO classes. If this parade is in the layer (probably not such a big answer) then the former layer is where I make the PTO announcement. But not more often, its 'service' which translates for you and this means that both 'service' and 'presentation' layer need reference of PTO and that (usually) their announcement is a separate, neutral Project / Assembly / Namespace / which can reference both the presentation layer and the service layer.


Comments