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:

{"The properties Model.Server.PersonType PersonType in Model.Server.Person and Model.Client.PersonType PersonType in Model.Client.PersonDto have different primitive types."}

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

So you need Enum-to-Enum in O2O mapping with one-to-one integer value mapping? If so, this must be pretty easy. Exactly :-) Can you implement this feature?

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:22

Support 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:

<MappingBuilderDefinition>
  <Items>
   ...
  </Items>
</MappingBuilderDefinition>

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

Sorry, we're working hard on v4.3 release (will be available today), so I'll reply when this is done. Okay :-)

This thread was imported from our support forum. The original discussion may contain more detailed answer.

asked Jul 04 '10 at 08:56

Peter%20%C5%A0ulek's gravatar image

Peter Šulek
492313236

So you need Enum-to-Enum in O2O mapping with one-to-one integer value mapping? If so, this must be pretty easy.

(Jul 04 '10 at 08:56) Alex Yakunin Alex%20Yakunin's gravatar image

One 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.

answered Jul 05 '10 at 06:11

Alex%20Yakunin's gravatar image

Alex Yakunin
29714412

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?

(Jul 05 '10 at 06:11) Peter Šulek Peter%20%C5%A0ulek's gravatar image

1 week is gone, what about support for enums, is there any build where is such feature implemented,pls?

(Jul 05 '10 at 06:11) Peter Šulek Peter%20%C5%A0ulek's gravatar image

Sorry, we're working hard on v4.3 release (will be available today), so I'll reply when this is done.

(Jul 05 '10 at 06:11) Alex Yakunin Alex%20Yakunin's gravatar image

Can i ask again to implement such feature soon (support for integer enums) ?

(Jul 05 '10 at 06:11) Peter Šulek Peter%20%C5%A0ulek's gravatar image

Any update on this issue?

(Apr 13 '11 at 04:33) Peter Šulek Peter%20%C5%A0ulek's gravatar image

Peter, not yet.

I suspect that the only way for now is to use a shared assembly with enums.

(Apr 14 '11 at 05:32) Dmitri Maximov Dmitri%20Maximov's gravatar image

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.

(Apr 15 '11 at 04:20) Peter Šulek Peter%20%C5%A0ulek's gravatar image

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.

(Apr 15 '11 at 04:26) Dmitri Maximov Dmitri%20Maximov's gravatar image

Ok thats fair enough

(Apr 15 '11 at 06:19) Peter Šulek Peter%20%C5%A0ulek's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×574

Asked: Jul 04 '10 at 08:56

Seen: 4,759 times

Last updated: Apr 15 '11 at 06:19

powered by OSQA