{"id":177817,"date":"2013-04-24T11:56:03","date_gmt":"2013-04-24T07:56:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=177817"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=177817","title":{"rendered":"<span class=\"post_title\">\u0420\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433 \u0441 \u0431\u0443\u0431\u043d\u043e\u043c, \u0438\u043b\u0438 \u043a\u0430\u043a \u043c\u044b \u0445\u0430\u043b\u043a\u0430 \u0443\u0441\u043c\u0438\u0440\u044f\u043b\u0438<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/85d\/4bb\/cec\/85d4bbcec400facab579ec2834233d9f.jpg\"\/><\/p>\n<p>  \u0414\u0443\u043c\u0430\u044e, \u0432\u0441\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u044f\u0442\u0441\u044f, \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0441\u0442\u0430\u0440\u0442\u0430\u043f\u043e\u0432 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u044b \u043d\u0430 \u043a\u043e\u043b\u0435\u043d\u043a\u0435. \u0422\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0434\u0430\u0447\u043d\u043e\u0433\u043e \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0432\u0430\u043d\u0438\u044f, \u043f\u0440\u0438 \u0433\u0440\u0430\u043c\u043e\u0442\u043d\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0438 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0446\u0435\u043b\u0435\u0439 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u044b \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430. \u0425\u043e\u0440\u043e\u0448\u043e, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0440\u0430\u043d\u044c\u0448\u0435 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0411\u0440\u044e\u0441\u0430 \u0411\u0430\u043d\u043d\u0435\u0440\u0430 \u0432 \u0425\u0430\u043b\u043a\u0430. \u041d\u043e \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0431\u044b\u043b \u0431\u043b\u0430\u0433\u043e\u043f\u043e\u043b\u0443\u0447\u043d\u043e \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d, \u0438 \u0440\u0435\u0441\u0443\u0440\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0433\u043e \u0437\u0435\u043b\u0435\u043d\u043e\u0433\u043e \u043f\u043b\u043e\u0445\u043e-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u0433\u0438\u0433\u0430\u043d\u0442\u0430? \u041a\u0430\u043a \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u0432 \u0442\u0430\u043a\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438? <a name=\"habracut\"><\/a><\/p>\n<p>  \u041f\u0435\u0440\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u2013 \u044d\u0442\u043e \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c, \u0434\u0435\u0440\u0436\u0430 \u043f\u043e\u0434\u043c\u044b\u0448\u043a\u043e\u0439 \u0442\u043e\u043c\u0438\u043a\u0438 \u0424\u0430\u0443\u043b\u0435\u0440\u0430 \u0438 \u0413\u041e\u0424\u0410. \u0415\u0441\u0442\u044c \u043d\u043e: \u043d\u0430\u0432\u0440\u044f\u0434 \u043b\u0438 \u0442\u0430\u043a\u043e\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u043e\u0441\u043f\u0440\u0438\u043c\u0443\u0442 \u0432\u0441\u0435\u0440\u044c\u0435\u0437. \u0412\u0442\u043e\u0440\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0443\u0436\u0435 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u0435\u043c\u043b\u0435\u043c\u043e\u0435 \u2013 \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u043c\u0438 \u0448\u0430\u0436\u043a\u0430\u043c\u0438 \u0443\u043d\u0438\u0437\u0438\u0442\u044c \u0410\u043b\u0435\u043a\u0441\u0430\u043d\u0434\u0440\u0430 \u041c\u0430\u043a\u0435\u0434\u043e\u043d\u0441\u043a\u043e\u0433\u043e, \u0438 \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u0440\u0430\u0441\u043f\u0443\u0442\u0430\u0442\u044c \u0413\u043e\u0440\u0434\u0438\u0435\u0432 \u0423\u0437\u0435\u043b.<\/p>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043e\u043f\u044b\u0442\u043e\u043c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0435\u0441\u044c\u043c\u0430 \u0437\u0430\u043f\u0443\u0442\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u043d\u0430 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0435 \u0441\u043b\u043e\u0438 \u0438 \u043f\u043e\u043a\u0440\u044b\u0442\u043e\u0435 \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u0430\u043c\u0438. \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u0440\u0438\u043c\u0435\u0440\u044b, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435, \u0432 \u043c\u0435\u0440\u0443 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u044b. \u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0438\u0445 \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438. \u041f\u0435\u0440\u0435\u0434 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0441\u0442\u043e\u0438\u0442 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0430\u0432\u0442\u043e\u0440 \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0432\u0435\u0441\u043e\u043c\u044b\u0445 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u043a\u043e\u0434\u0430. \u0422\u0430\u043a\u0436\u0435 \u0441\u0442\u043e\u0438\u0442 \u0443\u0442\u043e\u0447\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043d\u0430 ASP.NET \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Webforms.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0447\u043d\u0435\u043c \u043d\u0430\u0448\u0438 \u043f\u043b\u044f\u0441\u043a\u0438:<\/p>\n<h4>\u0424\u0438\u0433\u0443\u0440\u0430 \u043f\u0435\u0440\u0432\u0430\u044f \u2013 \u0437\u0430\u043f\u0443\u0442\u0430\u043d\u043d\u0430\u044f.<\/h4>\n<p>  \u0421\u0430\u043c\u0430\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u2013 \u044d\u0442\u043e \u0441\u043c\u0435\u0448\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430, \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0437\u0430 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 html, \u0441 \u043a\u043e\u0434\u043e\u043c DAL-\u0430. \u0422\u043e \u0435\u0441\u0442\u044c, \u0432\u043e\u0442 \u0442\u0430\u043a\u0430\u044f \u043f\u0438\u0441\u0430\u043d\u0438\u043d\u0430, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0430\u044f\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 UserControl-\u0430, \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0430\u0441\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0447\u0430\u0441\u0442\u043e:<\/p>\n<pre><code class=\"cs\">StringBuilder content = new StringBuilder(); var persons = Database.Persons.GetListBySchool(school); foreach(var person in persons) {    content.AppendFormat(@\u201d&lt;p&gt;{0}&lt;\/p&gt;\u201d, person.Name); } <\/code><\/pre>\n<p>  \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u0440\u0430\u0441\u043a\u043b\u0430\u0434\u0435 \u043d\u0438 \u043e \u043a\u0430\u043a\u043e\u0439 \u0441\u043c\u0435\u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u043f\u0435\u0440\u0441\u043e\u043d \u0438 \u043c\u0435\u0447\u0442\u0430\u0442\u044c \u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f. \u0410 \u0443\u0436 \u043e \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0435 \u0441\u0435\u0433\u043e \u043a\u043e\u0434\u0430 \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u044f \u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u043e\u043b\u0447\u0443. \u0412\u0441\u043a\u043e\u0440\u0435 \u043c\u043d\u043e\u0439 \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0435\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u0431\u0435\u0437\u0431\u043e\u043b\u0435\u0437\u043d\u0435\u043d\u043d\u043e \u0440\u0430\u0437\u043e\u0440\u0432\u0430\u0442\u044c \u0441\u0432\u044f\u0437\u044c \u043c\u0435\u0436\u0434\u0443 UI \u0438 DAL. <\/p>\n<pre><code class=\"cs\">public interface ICommand {    void Execute(); } <\/code><\/pre>\n<pre><code class=\"cs\">public abstract class Command&lt;T&gt; : ICommand {    public T Result { get; protected set; }    public abstract void Execute(); } <\/code><\/pre>\n<pre><code class=\"cs\">public interface ICommandExecutor {    T Run&lt;T&gt;(Command&lt;T&gt; command); } <\/code><\/pre>\n<p>  \u041a\u0430\u0436\u0434\u0430\u044f \u0435\u0434\u0438\u043d\u0438\u0446\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u0442\u0430\u043b\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439, \u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u0430 \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cs\">public class GetListBySchool: Command&lt;List&lt;DbPerson&gt;&gt; {    public DbSchool School { get; set; }      public override void Execute()    {       this.Result = Database.Persons.GetListBySchool(this.School);    } } <\/code><\/pre>\n<p>  \u0410 \u0432\u043e\u0442 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f ICommandExecutor:<\/p>\n<pre><code class=\"cs\">public T Run&lt;T&gt;(Command&lt;T&gt; command) {    command.Execute();    return command.Result; } <\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u043a\u043e\u0434 \u0432\u043d\u0443\u0442\u0440\u0438 \u044e\u0437\u0435\u0440-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043e\u0432 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043b\u0441\u044f \u0432:<\/p>\n<pre><code class=\"cs\">private readonly ICommandExecutor executor;   public SchoolView(ICommandExecutor executor) {    if (executor == null) { throw new ArgumentNullException(&quot;executor&quot;); }    this.executor = executor; }   public string GetPersonsHtmlList() {    StringBuilder content = new StringBuilder();    var persons = this.executor.Run(new GetListBySchool { School = school });    foreach(var person in persons)    {      content.AppendFormat(@\u201d&lt;p&gt;{0}&lt;\/p&gt;\u201d, person.Name);    } <\/code><\/pre>\n<p>  \u0412\u0440\u043e\u0434\u0435 \u0431\u044b \u0432\u0441\u0435 \u0445\u043e\u0440\u043e\u0448\u043e, \u043d\u043e \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u043f\u0440\u044f\u043c\u044b\u0445 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441\u0442\u0430\u043b\u043e \u044f\u0441\u043d\u043e, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0418 \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u044d\u0442\u043e\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439. \u041a\u043b\u0430\u0441\u0441 <b>DbPerson<\/b> \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043b \u0432 \u0441\u0435\u0431\u0435 \u043c\u043d\u043e\u0433\u043e \u043b\u043e\u0433\u0438\u043a\u0438 \u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u043d\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0435 \u043f\u0430\u0431\u043b\u0438\u043a \u0441\u0435\u0442\u0442\u0435\u0440\u0430. \u041f\u0435\u0440\u0432\u044b\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0431\u044b\u043b\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u044b, \u043a\u0430\u043a <b>virtual<\/b>, \u0438 \u0437\u0430\u043c\u043e\u043a\u0430\u043d\u044b. \u041d\u043e \u0442\u0440\u0435\u0442\u044c\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0438\u043c\u0435\u043b\u043e \u0442\u0438\u043f, \u0438\u043c\u0435\u044e\u0449\u0438\u0439 \u0442\u043e\u043b\u044c\u043a\u043e <b>private<\/b> \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u2013 \u044d\u0442\u043e \u0438 \u0441\u0442\u0430\u043b\u043e \u043a\u0430\u043c\u043d\u0435\u043c \u043f\u0440\u0435\u0442\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f. \u0412 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u043a\u0442\u043e-\u0442\u043e \u0441\u0442\u0443\u043a\u043d\u0443\u043b \u043f\u043e \u0441\u0442\u043e\u043b\u0443 \u043a\u0443\u043b\u0430\u043a\u043e\u043c \u0438 \u0441\u043a\u0430\u0437\u0430\u043b, \u0447\u0442\u043e, \u0440\u0430\u0437 \u0440\u0435\u0448\u0438\u043b\u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0431\u0435\u0437 \u043a\u043e\u0441\u0442\u044b\u043b\u0435\u0439, \u0442\u043e \u0438 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f. \u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0435 <b>virtual<\/b>, \u0431\u044b\u043b\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0438 \u043c\u043e\u0437\u0433 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0432 \u043f\u043e\u0438\u0441\u043a\u0430\u0445 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043b\u0435\u0436\u0430\u043b\u043e \u043d\u0430 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438, \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0438 \u0443 \u043a\u043e\u0433\u043e \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u043b\u043e \u0441\u043c\u0435\u043b\u043e\u0441\u0442\u0438 \u0435\u0433\u043e \u043e\u0437\u0432\u0443\u0447\u0438\u0442\u044c, \u0438\u0431\u043e \u043e\u043d\u043e \u0432\u043b\u0435\u043a\u043b\u043e \u0437\u0430 \u0441\u043e\u0431\u043e\u0439 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u043d\u0443\u0434\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b. \u0410 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435: <b>DTO<\/b>. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 UserControl-\u043e\u0432 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u044f\u0432\u043b\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u043a\u043e\u043f\u0438\u0435\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 DAL, \u043d\u043e \u0431\u0435\u0437 \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0438, \u0441 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0433\u0435\u0442\u0442\u0435\u0440\u0430\u043c\u0438 \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u0430\u043c\u0438. \u0427\u0442\u043e\u0431\u044b \u0434\u0430\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u043b\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c, \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440\u044b. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0431\u044b\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b extension-\u043c\u0435\u0442\u043e\u0434\u044b.<\/p>\n<p>  \u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441\u0442\u0430\u043b\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cs\">public class GetListBySchool: Command&lt;List&lt;Person&gt;&gt; {    public long SchoolId { get; set; }      public override void Execute()    {       var dbSchool = DataBase.Instance.GetSchoolById(this.SchoolId);       this.Result = dbSchool.Network.Memberships          .GetListBySchool(this.School)          .Select(person =&gt; person.Convert())          .ToList();    } } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0448 \u043c\u0435\u0442\u043e\u0434 <b>GetPersonsHtmlList<\/b> \u0441\u0442\u0430\u043b \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c, \u043e\u0434\u043d\u0430\u043a\u043e, \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0434\u0440\u0443\u0433\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430: \u0432\u043d\u0443\u0442\u0440\u0438 UserControl-\u0430 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439, \u0438\u0445 \u043c\u043d\u043e\u0433\u043e. \u0418 \u0435\u0441\u043b\u0438 \u0440\u0430\u043d\u044c\u0448\u0435 \u043e\u0431\u044a\u0435\u043a\u0442 <b>DbSchool<\/b> \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u043b\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437, \u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043d \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435, \u0430 \u044d\u0442\u043e \u043d\u0435 \u0435\u0441\u0442\u044c \u043a\u043e\u043c\u0438\u043b\u044c\u0444\u043e. \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043a \u043d\u0430\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 <b>IContextManager<\/b> \u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c <\/p>\n<pre><code class=\"cs\">T GetFunctionResult&lt;T&gt;(Func&lt;T&gt; func) where T : class;  <\/code><\/pre>\n<p>  \u0421 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 \u043c\u044b \u043e\u0441\u043e\u0431\u043e \u043d\u0435 \u0437\u0430\u043c\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043b\u0438\u0441\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0432 <b>HttpContext.Current<\/b>. \u0422\u043e \u0435\u0441\u0442\u044c, \u0435\u0441\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437, \u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442. \u0415\u0441\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u0442\u043e\u0440\u043e\u0439, \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u0437, \u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0438\u0437 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430. \u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f <b>IContextManager<\/b> \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 <b>CommandExecutor<\/b>-\u0430, \u0438 \u0434\u0430\u043b\u0435\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432\u043e \u0432\u0441\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b (\u0443 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043d\u043e\u0432\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e). <\/p>\n<pre><code class=\"cs\">public T Run&lt;T&gt;(Command&lt;T&gt; command) {    command.Context = this.context;    command.Execute();    return command.Result; } <\/code><\/pre>\n<pre><code class=\"cs\">public class GetListBySchool: Command&lt;List&lt;Person&gt;&gt; {    public long SchoolId { get; set; }      public override void Execute()    {       var dbSchool = this.Context.GetFunctionResult(() =&gt; DataBase.Instance.GetSchoolById(this.SchoolId));       this.Result = dbSchool.Network.Memberships          .GetListBySchool(this.School)          .Select(person =&gt; person.Convert())          .ToList();    } } <\/code><\/pre>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435, \u0441 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0437\u0430\u0442\u0440\u0430\u0442\u0430\u043c\u0438, \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043e\u0442\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u043b\u043e\u0439 UI. \u0418, \u0447\u0442\u043e \u0435\u0449\u0435 \u0431\u043e\u043b\u0435\u0435 \u0432\u0430\u0436\u043d\u043e, \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043a\u0440\u044b\u0442\u044c \u044d\u0442\u043e\u0442 \u0441\u043b\u043e\u0439 unit-\u0442\u0435\u0441\u0442\u0430\u043c\u0438. \u0422\u0430\u043a\u0436\u0435 \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043d\u0430\u043c\u0451\u0442\u043a\u0438 \u0434\u043b\u044f \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u043b\u043e\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438. \u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0438\u043c\u0435\u044f \u043d\u0430\u0431\u043e\u0440 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0438\u0445 \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u2014 \u043f\u0440\u043e\u0449\u0435, \u043d\u0435\u0436\u0435\u043b\u0438 \u043f\u0440\u043e\u0434\u0443\u043c\u044b\u0432\u0430\u0442\u044c \u0433\u0440\u0430\u043c\u043e\u0442\u043d\u0443\u044e \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0441 \u043d\u0443\u043b\u044f. <\/p>\n<h4>\u0424\u0438\u0433\u0443\u0440\u0430 \u0432\u0442\u043e\u0440\u0430\u044f \u2013 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u0430\u044f.<\/h4>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0441\u0442\u0430\u043b\u043e \u0438\u0437\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0442 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u043a \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 Request.Params. \u041d\u043e \u0437\u0434\u0435\u0441\u044c \u043d\u0438 \u0443 \u043a\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u043e, \u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u043b\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c:<\/p>\n<pre><code class=\"cs\">public interface IParametersReader {     string GetRequestValue(string key); } <\/code><\/pre>\n<pre><code class=\"cs\">public class RequestParametersReader : IParametersReader {     private readonly HttpContextBase context;       public RequestParametersReader(HttpContextBase context)     {         if (context == null) { throw new ArgumentNullException(&quot;context&quot;); }         this.context = context;     }       public string GetRequestValue(string key)     {         return this.context.Request[key];     } } <\/code><\/pre>\n<h4>\u0424\u0438\u0433\u0443\u0440\u0430 \u0442\u0440\u0435\u0442\u044c\u044f \u2013 \u0432\u043e\u0437\u0434\u0443\u0448\u043d\u0430\u044f.<\/h4>\n<p>  \u041a\u0430\u043a \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u043e \u0431\u044b\u0432\u0430\u0435\u0442, \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0441\u043e\u0441\u0442\u043e\u044f\u0442 \u043d\u0435 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e UserControl-\u0430, \u0430 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445. \u0412\u0441\u0435\u043c \u0438\u043c \u043d\u0443\u0436\u043d\u044b \u043e\u0434\u043d\u0438 \u0438 \u0442\u0435 \u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b. \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043d\u043e \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435:\u0412 \u0434\u0435\u0442\u0441\u043a\u043e\u043c UserControl-\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <\/p>\n<pre><code class=\"cs\">void Bind(DbSchool school, DbPerson person) {      this.school = school;      this.person = person; } <\/code><\/pre>\n<p>  \u0417\u0430\u0442\u0435\u043c \u043c\u0435\u0442\u043e\u0434 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e UserControl. \u0412\u0440\u043e\u0434\u0435 \u0431\u044b, \u0432\u0441\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0438 \u0442\u0430\u043a\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u0430\u0432\u043e \u043d\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0435. \u041e\u0434\u043d\u0430\u043a\u043e, \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c: \u043a\u043e\u0433\u0434\u0430 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043e\u0432 \u2013 \u0431\u043e\u043b\u0435\u0435 \u0434\u0432\u0443\u0445 \u0443\u0440\u043e\u0432\u043d\u0435\u0439, \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u0438\u0442\u044c\u0441\u044f \u0438\u043b\u0438 \u0437\u0430\u0431\u044b\u0442\u044c \u0437\u0430\u0434\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0443\u044e \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044e Dependency Outjection. \u0415\u0451 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0438\u0434\u0435\u044f \u2013 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u0438\u0437 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430, \u0430 \u0438\u0437 \u043e\u0431\u0449\u0435\u0439 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043f\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u0435\u0442 \u043b\u044e\u0431\u043e\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u044b\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430:<\/p>\n<pre><code class=\"cs\">public class InAttribute : Attribute {    public string Name { get; set; } } <\/code><\/pre>\n<p>  \u0438<\/p>\n<pre><code class=\"cs\">public class OutAttribute : Attribute {     public string Name { get; set; } } <\/code><\/pre>\n<p>  \u0422\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0432\u0435\u0441\u0438\u0442\u044c \u0432 \u0432\u043e\u0437\u0434\u0443\u0445\u0435, \u043f\u043e\u043c\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c Out. \u0422\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0434\u043e \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0432\u043e\u0437\u0434\u0443\u0445\u0430 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c, \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u043f\u043e\u043c\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c In.\u0414\u0430\u043b\u044c\u0448\u0435 \u2013 \u043b\u0438\u0448\u044c \u0434\u0435\u043b\u043e \u0442\u0435\u0445\u043d\u0438\u043a\u0438. \u041c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043a\u043b\u0430\u0441\u0441, \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u044b\u0439 \u043e\u0442 System.Web.UI.UserControl\u0418 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0432 \u043d\u0435\u0433\u043e \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"cs\">protected override void OnLoad(EventArgs e) {      \/\/\u0427\u0442\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430      var inProperties = this.GetType()           .GetProperties()           .Where(prop =&gt; prop.GetCustomAttributes(typeof(InAttribute), false).Any());            foreach (var property in inProperties)            {                 var inAttribute =                    property.GetCustomAttributes(typeof(InAttribute), false).First() as InAttribute;                 if (inAttribute == null) { continue; }                   property.SetValue(                      this,                       this.context.Get(string.IsNullOrWhiteSpace(inAttribute.Name) ? property.Name : inAttribute.Name),                        null);             }         base.OnLoad(e);        \/\/\u0417\u0430\u043f\u0438\u0441\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442      var outProperties = this.GetType()           .GetProperties()           .Where(prop =&gt; prop.GetCustomAttributes(typeof(OutAttribute), false).Any());            foreach (var property in outProperties)            {               var outAttribute = property.GetCustomAttributes(                   typeof(OutAttribute), false).First() as OutAttribute;               if (outAttribute == null) { continue; }                 this.context.Add(string.IsNullOrWhiteSpace(outAttribute.Name) ? property.Name : outAttribute.Name, property.GetValue(this, null));            }  } <\/code><\/pre>\n<h4>\u042d\u043f\u0438\u043b\u043e\u0433:<\/h4>\n<p>  \u0422\u0430\u043a\u0438\u043c \u0441\u0442\u0430\u043b \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u0442\u0430\u043f \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u043d\u0430\u0448\u0435\u0433\u043e <s>\u0437\u0435\u043b\u0435\u043d\u043e\u0433\u043e \u043c\u043e\u043d\u0441\u0442\u0440\u0430<\/s> \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430. \u0418\u0442\u043e\u0433\u043e\u043c \u043d\u0430\u0448\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0442\u0430\u043b\u0438:<\/p>\n<p>   1. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u044f UserControl-\u043e\u0432 \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u0430\u043c\u0438. <br \/>  2. \u0411\u043e\u043b\u0435\u0435 \u0447\u0435\u0442\u043a\u043e\u0435 \u043e\u0442\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u044f UI \u043e\u0442 \u0432\u0441\u0435\u0433\u043e \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e. <br \/>  3. \u0418\u0437\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0442 \u0436\u0435\u0441\u0442\u043a\u043e\u0439 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u043c\u0435\u0436\u0434\u0443 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c\u0438 UserContol-\u0430\u043c\u0438.<br \/>  4. \u0423\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435 \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u0438 \u043a\u043e\u0434\u0430.<br \/>  5. \u0423\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0435 \u043c\u043e\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0440\u0437\u0430\u043d\u0438\u0439 \u0438 \u043e\u0447\u0438\u0449\u0435\u043d\u0438\u0435 \u0441\u043e\u0432\u0435\u0441\u0442\u0438 \ud83d\ude09<\/p>\n<p>  <i>\u0410\u0432\u0442\u043e\u0440 \u0441\u0442\u0430\u0442\u044c\u0438: \u0412\u0438\u0442\u0430\u043b\u0438\u0439 \u041b\u0435\u0431\u0435\u0434\u0435\u0432, \u0432\u0435\u0434\u0443\u0449\u0438\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0414\u043d\u0435\u0432\u043d\u0438\u043a.\u0440\u0443<\/i>    \t \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/company\/dnevnik_ru\/blog\/177817\/\"> http:\/\/habrahabr.ru\/company\/dnevnik_ru\/blog\/177817\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/85d\/4bb\/cec\/85d4bbcec400facab579ec2834233d9f.jpg\"\/><\/p>\n<p>  \u0414\u0443\u043c\u0430\u044e, \u0432\u0441\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u044f\u0442\u0441\u044f, \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0441\u0442\u0430\u0440\u0442\u0430\u043f\u043e\u0432 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u044b \u043d\u0430 \u043a\u043e\u043b\u0435\u043d\u043a\u0435. \u0422\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0434\u0430\u0447\u043d\u043e\u0433\u043e \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0432\u0430\u043d\u0438\u044f, \u043f\u0440\u0438 \u0433\u0440\u0430\u043c\u043e\u0442\u043d\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0438 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0446\u0435\u043b\u0435\u0439 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u044b \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430. \u0425\u043e\u0440\u043e\u0448\u043e, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0440\u0430\u043d\u044c\u0448\u0435 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0411\u0440\u044e\u0441\u0430 \u0411\u0430\u043d\u043d\u0435\u0440\u0430 \u0432 \u0425\u0430\u043b\u043a\u0430. \u041d\u043e \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0431\u044b\u043b \u0431\u043b\u0430\u0433\u043e\u043f\u043e\u043b\u0443\u0447\u043d\u043e \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d, \u0438 \u0440\u0435\u0441\u0443\u0440\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0433\u043e \u0437\u0435\u043b\u0435\u043d\u043e\u0433\u043e \u043f\u043b\u043e\u0445\u043e-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u0433\u0438\u0433\u0430\u043d\u0442\u0430? \u041a\u0430\u043a \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u0432 \u0442\u0430\u043a\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438? <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-177817","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/177817","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=177817"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/177817\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=177817"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=177817"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=177817"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}