domain-model

Is lots of add/change methods and constructor overloads a consequence of DDD?

梦想的初衷 提交于 2019-12-06 15:49:18
I have a class: public class Person { public string FirstName { get; private set; } public string LastName { get; private set; } public string Email { get; private set; } public string Telephone { get; private set; } public Address Address { get; private set; } public Person(string firstName, string lastName) { //do null-checks FirstName = firstName; LastName = lastName; Address = new Address(); } public void AddOrChangeEmail(string email) { //Check if e-mail is a valid e-mail here Email = email; } public void AddOrChangeTelephone(string telephone) { //Check if thelephone has correct format

ASP.NET MVC - view model, domain model and data model [closed]

天大地大妈咪最大 提交于 2019-12-05 22:51:25
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I am using entity framework in my latest ASP.NET MVC 3 project. As it is DB first, the entity framework generates Database models . In

PHP Domain Model

会有一股神秘感。 提交于 2019-12-05 16:04:01
问题 I have been programming in PHP for several years and have in the past adopted methods of my own to handle data within my applications. I have built my own MVC in the past and have a reasonable understanding of OOP within php but I know my implementation needs some serious work. In the past I have used an is-a relationship between a model and a database table. I now know after doing some research that this is not really the best way forward. As far as I understand it I should create models

What is the best database structure for this scenario?

老子叫甜甜 提交于 2019-12-05 06:08:13
问题 I have a database that is holding real estate MLS (Multiple Listing Service) data. Currently, I have a single table that holds all the listing attributes (price, address, sqft, etc.). There are several different property types (residential, commercial, rental, income, land, etc.) and each property type share a majority of the attributes, but there are a few that are unique to that property type. My question is the shared attributes are in excess of 250 fields and this seems like too many

Is it possible to reuse the DataAnnotations in ViewModel?

社会主义新天地 提交于 2019-12-05 04:41:32
问题 In my MVC application, I defined the DataAnnotations in the domain models. Although the DataAnnotations properties as Display, etc. can be retrieved when using Domain model, they cannot be retrieved when using the same properties on ViewModel and using this ViewModel. I think it is not seem to good to define the DataAnnotations in ViewModel again. So, is it possible or which way should I follow? Domain Model: public class Issue { [Key] public int ID { get; set; } [Required(ErrorMessage =

Winforms data-binding to business objects in a multi-threaded scenario without InvokeRequired?

我只是一个虾纸丫 提交于 2019-12-04 05:23:46
问题 For example, I've got a business object Person : class Person : INotifyPropertyChanged { string Name { get; set; } DateTime DateOfBirth { get; set; } } // ^ abbreviated for better legibility; implementation would be trivial And I've got some Winforms UI controls data-bound to an object of this class: Person somePerson = ...; nameTextBox.DataBindings.Add("Text", somePerson, "Name"); dobDatePicker.DataBindings.Add("Value", somePerson, "DateOfBirth"); Now I am making changes to somePerson and

ASP.NET MVC - view model, domain model and data model [closed]

匆匆过客 提交于 2019-12-04 04:41:40
I am using entity framework in my latest ASP.NET MVC 3 project. As it is DB first, the entity framework generates Database models . In my service (business) layer I Scaffold (MvcScaffolding) to generate service methods, views and controllers. Scaffolding also generates the domain models . When binding these models to the Views, I use view models . In short, I ended up in using three types of models. Is this Ok? The view models are kept in the Presentation layer, domain models are kept in the business layer and data models are kept in the repository layer. Please let me know your thoughts. That

NHibernate many-to-many assocations making both ends as a parent by using a relationship entity in the Domain Model

左心房为你撑大大i 提交于 2019-12-03 22:47:50
Entities: Team <-> TeamEmployee <-> Employee Requirements: A Team and an Employee can exist without its counterpart. In the Team-TeamEmployee relation the Team is responsible (parent) [using later a TeamRepository]. In the Employee-TeamEmployee relation the Employee is responsible (parent) [using later an EmployeeRepository]. Duplicates are not allowed. Deleting a Team deletes all Employees in the Team, if the Employee is not in another Team. Deleting an Employee deletes only a Team, if the Team does not contain no more Employees. Mapping: public class TeamMap : ClassMap<Team> { public TeamMap

Is it possible to reuse the DataAnnotations in ViewModel?

懵懂的女人 提交于 2019-12-03 20:35:14
In my MVC application, I defined the DataAnnotations in the domain models. Although the DataAnnotations properties as Display, etc. can be retrieved when using Domain model, they cannot be retrieved when using the same properties on ViewModel and using this ViewModel. I think it is not seem to good to define the DataAnnotations in ViewModel again. So, is it possible or which way should I follow? Domain Model: public class Issue { [Key] public int ID { get; set; } [Required(ErrorMessage = "Required")] [Display(Name = "Project Number")] public int ProjectID { get; set; } [Required(ErrorMessage =

What is the best database structure for this scenario?

自作多情 提交于 2019-12-03 20:26:20
I have a database that is holding real estate MLS (Multiple Listing Service) data. Currently, I have a single table that holds all the listing attributes (price, address, sqft, etc.). There are several different property types (residential, commercial, rental, income, land, etc.) and each property type share a majority of the attributes, but there are a few that are unique to that property type. My question is the shared attributes are in excess of 250 fields and this seems like too many fields to have in a single table. My thought is I could break them out into an EAV (Entity-Attribute-Value)