Data access layer design in DDD

后端 未结 2 1374
萌比男神i
萌比男神i 2021-01-20 00:59

Excuse me for my poor English.

Ok, I\'m thinking about DDD approach now and it sounds great but... There is one little question about it. DDD says that the domain mo

2条回答
  •  生来不讨喜
    2021-01-20 01:47

    public class BusinessObject
    {
        private string _user;
        private string _domain;
    
       public BusinessObject(string email)
       {
          string[] s = value.Split("@");
          _user = s[0];
          _domain = s[1];    
       } 
    
       public BusinessObject(string user, string domain)
        {
            _user = user;
            _domain = domain;
        }
    
        public string Email
        {
            get { return _user + "@" + _domain; }
        }
    }
    

    One simple solution is to just have your DAL call new BusinessObject(email)

提交回复
热议问题