English 中文(简体)
AutoMapper是一种可行的替代办法,可替代两种方式的数据,使用一种形式表示。
原标题:AutoMapper a viable alternative to two way databinding using a FormView?

I ve started using the FormView control to enable two way databinding in asp.net webforms. I liked that it saved me the trouble of writing loadForm and unloadForm routines on every page. So it seemed to work nicely at the start when I was just using textboxes everywhere....but when it came time to start converting some to DropDownLists, all hell broke lose. For example, see: Not possible to load DropDownList on FormView from code behind? ....and I had many additional problems after that.

因此,我是在关于“自动交换器”的一篇文章上,我非常了解这一点,但从该文章的音响来看,这might是一个可行的替代办法,可替代双向数据,对一个域实体表示反对的一种形式? 根据我的理解,自动估价器基本上在命名公约上运作,因此,它将寻找来源和目的地的对应名称。

因此,基本上,我拥有所有拥有财产的领域实体(即:个人)(第一民族、上尼亚美、地址等)。

因此,如果这样做的话,一个人就只能完全摆脱曲解的表态控制,这只是一个具有约束力的、不具约束力的网络格式。

(我知道,当然,如果我使用MVC I,那就没有这些问题。)

<Caveat 1: AutoMapper必须了解每个控制项目的适当property name 类型 (控制权本身与实体的财产相同,但行为取决于控制类型),即:

Person.FirstName --> form.FirstName..Text
Person.Country --> form.Country.SelectedValue
Person.IsVerified --> form.IsVerified.Checked

......因此,必须先令对表格进行控制,确定其类型,然后在域标和网络格式控制之间对控制的适当财产进行负荷/卸载。

<Caveat 2: Nested Controls - totrice matters further, if one could adopt a webform to AutoMapper (我不知道你是否能够做到),来文方/目的地控制不一定是网络版的根基,因此,人们必须能够对通过网络格式进行的所有儿童控制(这是一件易事)的重新搜索,并退回所有有效的国际调查要素类型。

Caveat 3: User control UI elements are not public - when traversing the nested control hierarchy in #2, if you are using user controls, which do not expose their contained elements publicly (without hardcoding it so), one would have to do a FindControl for each element in the current AutoMapper collection. This one seems like a potential dealbreaker....
a) performance could be really bad (although if a User Control was found, it could be passed to the back of the queue and only processed if necessary)
b) from within an individual map function, how does one get reference to all the siblings of the current mapped element, in the current mapping function?

任何想法?

Update

从我刚才看,这似乎与一条道路一样,很可能要走下去:

http://automapper.codeplex.com/wikipage?title=Custom%20Type%20Converters&referringTitle=Home
http://msdn.microsoft.com/en-us/library/ayybcxe5%28VS.71%29.aspx

问题回答

我认为,你最好的长期解决办法是,检查网上森林产品,如果你能够转向微型木材委员会的环境,就会在网上提供一个更好的抽象层。 届时,你会更方便地绘制时间图,并受益于多国企业模式。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签