Hi there, I'm using O2O mapping feature of DO4 and have problem with enums. My situation is: Have 3 projects: 1. Model.Server - DataObject model library (created with project template DataObject.Net Model Project) wich has direct references to DO4 2. Model.Client - simple C# library project with NO direct or any other reference to DO4 libs, just simple lib of POCO classes as an mirror to DO4 entity classes 3. Server.Host - "Server" application (it is console, but should be WCF service or other) which references DO4 and both Model.Server and Model.Client Project Server.Host build mappings with O2O mapping builder feature in DO4 using class MappingBuilder. Makes some linq query select on DO4 entity class and transfor its result with mapping builder into POCO classes. For now everything works fine. Problem is that when entity class use some custom enum type which is defined in both Model.Server and Model.Client library, than error occurs when building mapping descriptor:
You should say to me that i must have some "shared" lib where i have defined custom enums and reference this shared lib from Model.Server and Model.Client, but this is not possible for me. I build application framework which loads assemblies dynamically and also makes mapping descriptor dynamically at runtime and i dont know at build-time about such enums. Also i dont want to rewrite properties which are of custom enum types to int types (which works) because i want to use enum type values in linq queries. Is there any change that you can implement such feature to allow also custom enums in O2O mapper, maybe automatically or extend interface IMappingBuilder with some method like MapEnum ? Because with this error i cannot use DO4 with my project! Created sample project for this scenario: Sample project download Updated at 05.07.2010 4:43:38
Also earlier you mention that API of O2O mapping will be rewrited to be easiest as is now, is this true? Because i have written code which dynamically make O2O mapping with reflection (pretty complex code btw). If you rewrite O2O mapper then you can make it more reflection friendly maybe :-) Updated at 05.07.2010 6:55:22Support for enums, 1 week is ok, going to vacation today for 1 week :-) Feature i like is possibility to also build mapping from XML string/stream/file whatever, something like:
Which can i use when dynamically loading assemblies into my framework that each of my "module" assembly tells me its "Items" node (e.g. by string or stream) and finally when i have loaded all of my module assemblies then i join these "Items" nodes together and call something like: MappingBuilder.BuildFrom(stringDefinition).Build(); Updated at 12.07.2010 12:15:13
This thread was imported from our support forum. The original discussion may contain more detailed answer. |
Concerning enums - how fast you need this to be fixed (i.e. week or two is ok)? Concerning user friendliness: first of all, we hope to provide a better auto-mapping API for it. If you can describe any other features you'd like to see there, you're welcome. Issue: http://code.google.com/p/dataobjectsdot ... ail?id=746 I set priority to critical, so we'll try to implement fast. Unfortunately, we can't close all the issues as fast as they appears - previous week was really hard from this point, so we were unable to implement this so far, and I'm really sorry for this. About support for enums, did you plan to implement it, is there any issue in google code to follow? About loading mapping from string, what do you think about it? 1 week is gone, what about support for enums, is there any build where is such feature implemented,pls? Sorry, we're working hard on v4.3 release (will be available today), so I'll reply when this is done. Can i ask again to implement such feature soon (support for integer enums) ? Any update on this issue? Peter, not yet. I suspect that the only way for now is to use a shared assembly with enums. Dmitri, i have such solution with shared assembly. But i asking if this will be fixed in short time, when it has critical priority and it is not fixed due today. Peter, I understand. I'm afraid that this won't be fixed shortly due to the lack of resources. However, after releasing 4.5 I'll try focusing on such annoying bugs like this one. Ok thats fair enough |
So you need Enum-to-Enum in O2O mapping with one-to-one integer value mapping? If so, this must be pretty easy.