Bmrxntfj. UIMapper interface object ing

Source: Internet
Author: User
Tags to domain

Bmrxntfj. UIMapper 0.1
(UIMapper) interface/object ing
The main purpose is to isolate the interface and focus on the domain model. In the domain model, everything is an object.
For example, O/RM is also used to isolate the conversion from Relational Data to domain objects.
Some code that does not repeat, but feels repetitive, such:
1. UI-> Model (interface data is converted to domain data)
User. FirstName = txtFirstName. Text;
User. LastName = txtLastName. Text;
User. NickName = txtNickName. Text;

2. Model-> UI (domain data is converted to the interface)
TxtFirstName. Text = User. FirstName;
TxtLastName. Text = User. LastName;
TxtNickName. Text = User. NickName;

However, there may be a lot of code like this.
Bmrxntfj. UIMapper aims to solve such problems. Currently, Bmrxntfj. UIMapper only supports simple functions and cannot be used in practice. Bmrxntfj. UIMapper is an auxiliary tool. It only cares about the data transfer between the interface and the model and does not relate to the database.
Before development, there was a similar mature product Wilson UIMapper (http://uimapper.net), unfortunately only research free version.
In addition, some people in the garden have written similar things, but they are not mature.
MATERIALS:

Http://www.cnblogs.com/microsheen/archive/2005/06/06/168520.html

Http://microsheen.cnblogs.com/archive/2005/08/28/224607.html

Specific Application
Domain entity

Code
Public class User
{
Private string m_FirstName;
Private string m_LastName;
Private string m_NickName;
Private string m_Dept;

Public string FirstName
{
Get {return "FirstName ";}
Set {m_FirstName = value ;}
}
Public string LastName
{
Get {return "LastName ";}
Set {m_LastName = value ;}
}
Public string NickName
{
Get {return "NickName ";}
Set {m_NickName = value ;}
}
Public Dept
{
Get {return new Dept ();}
Set {m_Dept = value ;}
}
}

Public class Dept
{
Private string m_Name;
Private int m_MemeberCount;

Public string Name
{
Get {return "DeptName ";}
Set {m_Name = value ;}
}
Public int MemeberCount
{
Get {return 10 ;}
Set {m_MemeberCount = value ;}
}
}

Interface code:
<Asp: TextBox ID = "txtFirstName" runat = "server"> </asp: TextBox>
<Asp: TextBox ID = "txtLastName" runat = "server"> </asp: TextBox>
<Asp: TextBox ID = "txtNickName" runat = "server"> </asp: TextBox>
<Br/>
<Asp: TextBox ID = "txtName" runat = "server"> </asp: TextBox>
<Asp: TextBox ID = "txtMemeberCount" runat = "server"> </asp: TextBox>

Configuration file:
<? Xml version = "1.0"?>
<Page>
<Object type = "User">
<Property type = "System. String" name = "FirstName" controlid = "txtFirstName"> </property>
<Property type = "System. String" name = "LastName" controlid = "txtLastName"> </property>
<Property type = "System. String" name = "NickName" controlid = "txtNickName"> </property>
<Reference type = "Dept" name = "Dept">
<Property type = "System. String" name = "Name" controlid = "txtName"> </property>
<Property type = "System. String" name = "MemeberCount" controlid = "txtMemeberCount"> </property>
</Reference>
</Object>
</Page>

Code:
Model-> UI
Mapper mapper = new Mapper (Server. MapPath ("map. xml "));
Mapper. MappingUI (new User ());

UI-> Model
Mapper mapper = new Mapper (Server. MapPath ("map. xml "));
Object user = mapper. MappingObject (typeof (User ));
Source code file:
/Files/bmrxntfj/UIMapper.rar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.