Should Dto contains full information of reference object? [closed] - c#

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.
Improve this question
Let assume I have two entities are Order and Customer. So OrderDto should have CustomerId prop or full Customer object. The same with CustomerDto, should they have full list Order object or just a list of OrderId?

I think that it depends what you're using it for. The DTO should be specific to the needs of the api, not the Entities. For example if you're creating an order, you don't need to modify any properties of the customer. You shouldn't include the full customer details, just the CustomerId.

Related

Define constants needed in more than one class [closed]

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 5 years ago.
Improve this question
In my smart client solution, I have a Project folder with:
IProjectView.cs
*ProjectView*
ProjectView.cs
ProjectView.Designer.cs
ProjectView.GeneratedCode.cs
ProjectView.resx
ProjectViewPresenter.cs
I want to define some constants for user by ProjectView.cs and ProjectViewPresenter.cs. Both of these classes implement IProjectView.cs, so were I back in Java, I'd put them there. If this were C++, I'd create a class ProjectConstants.cs and have the classes inherit it, but C# doesn't allow multiple inheritance.
How do I do this?
Can having a Read-Only Property in your interface solve your problem?
string MyReadOnlyProperty { get; }
I have no clue if this is very performance-wise compared to constant thought.

ViewModel with a list of selectlists [closed]

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 7 years ago.
Improve this question
How do i create a ViewModel that consist of a list of SelectLists populated by DB?
You can create a View Model that contains properties with the various data needed for the select lists. Populate those properties in your controller action, and then use that View Model as your view's strongly-typed model.

Naming convention rules: Id in plural [closed]

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 8 years ago.
Improve this question
I have a question about C# naming convention rules.
I know that you write ex. CustomerId.
But what if it the property is a List of CustomerId's?
Should I write CustomerIds or CustomerIdS?
MSDN describes using pascal casing for member names. There is no specific guideline on plurals as far as I can see, but I would suggest CustomerIds since it feels more natural to me.
Also here the question between ID and Id is answered: use Id.

How to have nested classes/forms in asp.net [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm new to ASP.net and coming from a Ruby on Rails background. I have 3 tables in question they are Booking, Customer and Contact (contact being customer contact details). Basically what i want to do is have one form which will create all of the objects required in one go, so if i create a booking it also creates a customer and their contact details. I am familiar with this process in Rails which is accepts nested attributes for. I'd appreciate any pointers for a similar solution in ASP.net
I'd recommend learning Entity Framework as an ORM for this application.
http://msdn.microsoft.com/en-us/data/jj206878

A list of active views in prism [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Doez prism assign any unique identifier/guid maintained for each view ?
Perhaps in tracking any references etc?
Prism doesn't do it. But you can do it easily if needed. However, I learned that you don't need to do this if you properly use navigation and navigation parameters.

Categories

Resources