If a field is declared on an interface and marked with Field attribute, then that field cannot have the Field attribute on the class (PostSharp says it can only be defined once). The problem is that you then can't apply an index on the class that uses this field =( Updated at 18.05.2010 4:51:45Also, if InterfaceB inherits from InterfaceA, then you can't apply an index on InterfaceB that uses a field that is defined on InterfaceA Updated at 20.05.2010 20:15:31
The issue is fixed, see nightly builds. From now, you can mark a property with FieldAttribute both in interface and in implementors, the only requirement is that both attributes must have the same settings ('Length', 'Nullability', 'Scale', 'Precision' & 'LazyLoad') whereas 'Indexed' setting might differ.[/quote:1e0ujdgf] could you please update the 4.3 RC with this fix (for VS2010)? latest version does not support it =( thanks Updated at 21.05.2010 23:14:02just to be precise... i wasn't only talking about defining an index using [Field(Indexed=true)]. I was talking about applying [Index("PropertyA", "PropertyB", "PropertyC")] on a class ClassX where:
so... [Index("PropertyA", "PropertyB", "PropertyC")] class ClassX : Entity, InterfaceY, InterfaceZ { PropertyA get; set; PropertyB get; set; PropertyC get; set; } interface InterfaceY : InterfaceZ { PropertyB get; set; } interface InterfaceZ : IEntity { PropertyC get; set; } This thread was imported from our support forum. The original discussion may contain more detailed answer. |
Hi there, mahdness: 1. First case (interface, implementor & index) Try using the following syntax (as a temporary workaround, the issue is in work):
olorin: The issue is in work.
The issue is fixed, see nightly builds. From now, you can mark a property with FieldAttribute both in interface and in implementors, the only requirement is that both attributes must have the same settings ('Length', 'Nullability', 'Scale', 'Precision' & 'LazyLoad') whereas 'Indexed' setting might differ. Alex, the original message was about the possibility to mark an implemented property with [Field(Indexed = true)] attribute. The feature was implemented. All other field settings (see my previous post for the whole listing) can't be overridden as they affect the corresponding database column properties. The scenario you described should work in the current code base, whereas another one where an index which contains one or more inherited fields is defined (described here: http://code.google.com/p/dataobjectsdot ... ail?id=353) is still unsupported. As I've said earlier, it requires some noticeable changes to be applied to the Model builder code base, therefore I'm afraid that we can implement this only in 4.3.1 branch. Guys, see the original message. It's necessary to implement different behavior allowing to inherit [Field] settings from interface declaration. olorin wrote: Well as long as we can apply [Field] attribute to interface and to implementing class for the same property, that's ok for me. I'm working on this: http://blog.dataobjects.net/2010/05/dat ... 3-rc2.html |
olorin wrote: I'm also interested in a fix for this.
See viewtopic.php?f=29&t=5855&p=14412#p14411