Ah ~~ Recently, I spent my spare time modifying my blog. I found many foreign spam ads on the message board of my website during this time. " IP blacklist " Functions, messages andArticleThe verification code is also added to the comments.CodeI sorted it out. I hope that the newly added verification code will not cause inconvenience to comments and comments!
Today, a friend posted a message in the blog Park saying how to complete the blog. Sorry, I am changing my blog when I am free. 555 ~
The article is still transferred in his blog, the original address: http://www.youguanbumen.net/Article.aspx? Id = 74
[Original content]
In the previous article, we talked about declaring the attribute to implement delayed loading in the object class as virtual, and then inheriting the object class as a subclass to implement this attribute in the subclass, works with delegates to achieve perfect latency loading (the original "model layer" is still kept at the bottom layer for the layer-3 structure, at the same time, you can access the "data access layer" higher than others in the attributes of the object class). At the end of the article, there is still a cup of cake because this attribute may be required by our business before the model attribute is delayed, it is not just used as a storage and read function, but contains this complicated or simple logic code in its get or set accessors.
For example, consider this scenario. We have an entity class called a task list, which has two attributes: "Task Name" and "release time ", there are business rules that the task name can be blank, however, if the task name is blank, We need to read the "release time" to generate a task name to replace this null value (for example, "issue20110120191345"). Of course, this example is somewhat far-fetched, the main reason is that I can't think of a very specific instance, but in actual development, this is certainly the case, and the logic code in it may be complicated to your imagination.
Following the examples in the previous two articles, I simulated this phenomenon and made some modifications to the "article" object class, adding a string attribute named getcategoryrecord, basically, it can be seen from the literal that it is called "The get accessor call record of the category attribute ". Therefore, the "article" Class (base class) is modified as follows:
C # code ?
12345678910111213141516171819202122232425262728293031 |