EF4 POCO忽略问题和后果 [英] EF4 POCO Ignore Problem and ramifications

查看:60
本文介绍了EF4 POCO忽略问题和后果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一些关于CTP4中缺少Ignore功能的讨论以及使用动态关键字等的解决方法的一些好主意,但是使用现有的POCO kidna要求我们可以忽略现有对象的公共属性。

There's been some discussions about the lack of an Ignore feature in CTP4 and some good ideas for work-arounds using dynamic keyword, etc., however using existing POCOs kidna requires that we can ignore public properties on existing objects.

我想我会讨论这个问题的要求,以便获得最终版本所需的关注。 主要是因为我在Cigna Healthcare的团队正在开发基于此工具的工具,我们现在有一个现有的
POCO和DAL使用XMLSerializer。 我提到这个的原因是因为我们目前没有解决办法让我们现有的POCO图表与我们当前的DAL一起工作(这是一个全有或全无的方法),我需要能够转换
我们的DAL图层是块中的EF4,而不是一次全部。 

I thought I would just discuss the requirement for having this so that it gets the attention that it needs for the final release.  Mostly because my team at Cigna Healthcare is developing based on this tool's being available and we have an existing POCO and DAL that uses XMLSerializer today.  The reason that I'm mentioning this is because we don't currently have a solution to make our existing POCO graphs work along side our current DAL (its an all or nothing approach) and I need to be able to convert our DAL layer to EF4 in chunks, not all at once. 

我尝试指定适用于EF4但不适用于XML反序列化器的动态关键字。 例如:

I tried to specify dynamic keyword which works for EF4 but not for the XML Deserializer.  For example:

        [XmlArray(ElementName =" scenario")]
$
       公共动态场景

        {

           得到{return _scenarios; }
           设置{_scenarios = value; }
        }

        [XmlArray(ElementName = "scenarios")]
        public dynamic Scenarios
        {
            get { return _scenarios; }
            set { _scenarios = value; }
        }

 

指定动态会导致Xml反序列化程序忽略XmlArray。 当我尝试使用XmlElement类型时,它似乎工作,但后来我得到了运行时绑定器异常,CSharp.DLL和Core.DLL没有导入但奇怪的是我在
web config中导入这些并且能够做动态我代码中= 10。  - 所以我假设有一些关于xml序列化程序的东西与4.0 csharp活页夹不太一致。

Specifying dynamic causes the Xml Deserializer to balk at the XmlArray.  When I tried to use XmlElement with type, it seemed to work but then I got runtime binder exception that CSharp.DLL and Core.DLL are not imported but oddly I imported these in web config and was able to do dynamic i = 10 in the code.  - so I assume there is something about the xml serializer that does not quite work with the 4.0 csharp binder.

 

   &NBSP;&NBSP;&NBSP;&NBSP;&NBSP; [XmlElement(ElementName =" scenario",Type = typeof(PresaleCollection< int,Scenario>))]¥b $ b       公共动态场景

        {

           得到{return _scenarios; }
           设置{_scenarios = value; }
        }

        [XmlElement(ElementName = "scenarios", Type=typeof (PresaleCollection<int, Scenario>))]
        public dynamic Scenarios
        {
            get { return _scenarios; }
            set { _scenarios = value; }
        }

 

无效....

所以我没有解决方案到"忽略问题"

So I don't have a solution to the "Ignore problem"

要总结要求,需要通过Mapper为POCO类的任何公共属性指定忽略。

To summarize the requirement, need to specify a ignore for any public property of the POCO class via the Mapper.

对MSFT的问题:你能否提供关于忽略功能进入或退出最终版本的更明确的细节,你有什么想法,下一个delievry看起来像什么,CTP5或最终版本,我们何时可以期待至少一个CTP5 ?

Question to MSFT: can you provide with more definitive details about the ignore feature being in or out of the final release and do you have any ideas what the next delievry looks like, CTP5 or a final and when can we expect at least a CTP5 ?

 

谢谢

Marty

  ;

 

 

 

 

推荐答案

嗨Marty,

Hi Marty,

CTP5中将提供忽略功能,两者都有通过属性和Fluent API。 CTP5将在未来几周内上市。

Ignore functionality will be available in CTP5, both via attributes and the Fluent API. CTP5 will be available in the next couple of weeks.

~Rowan


这篇关于EF4 POCO忽略问题和后果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆