google-code-export / otis-lib

Automatically exported from code.google.com/p/otis-lib
2 stars 0 forks source link

'helper' class attribute #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I need to use 'custom' method while transforming some attributes ('helper'
class attribute). It seems that conversion method set on helper attribute
has to be in the same dll as the target DTO class. 

This is Your web site example :

<class name="Otis.Tests.UserDTO, Otis.Tests"
source="Otis.Tests.Entity.User, Otis.Tests" helper="Otis.Tests.Util.Convert" >

...and this is what I am trying to do :

<class name="Otis.Tests.UserDTO, Otis.Tests"
source="Otis.Tests.Entity.User, Otis.Tests"
helper="Diffrent.Namespace.Util.Convert, Different.Dll" >

It leads to 'Otis.OtisException' on calling 'GetAssembler' method.

Am I doing sth. wrong ?

Thanks in advance.

Original issue reported on code.google.com by prodakow...@gmail.com on 26 May 2008 at 9:08

GoogleCodeExporter commented 9 years ago
I didn't have time to check it yet, but there is AddAssemblyReference method on
Configuration class which can be used. So during configuration building do 
something
like:
   cfg.AddAssemblyReference("Different.dll");

and in mapping:
<class name="Otis.Tests.UserDTO, Otis.Tests"
source="Otis.Tests.Entity.User, Otis.Tests"
helper="Different.Namespace.Util.Convert" > 
// note: this is the name of the method, so there is no ', Different.dll' part 

Please inform me if this helps.

Original comment by zdeslav....@gmail.com on 26 May 2008 at 3:07

GoogleCodeExporter commented 9 years ago
Ok, I have just tried the proposed approach, and it works.

During assembly generation, Otis automatically adds references to itself, all 
the
assemblies which contain the mapped classes and all the assemblies that define 
base
class and interfaces of mapped classes. However, other assemblies must be 
explicitly
referenced via Configuration,AddAssemblyReference (3 overloads).

Original comment by zdeslav....@gmail.com on 27 May 2008 at 10:00

GoogleCodeExporter commented 9 years ago
Thanks :)

Original comment by prodakow...@gmail.com on 27 May 2008 at 10:53

GoogleCodeExporter commented 9 years ago

Original comment by zdeslav....@gmail.com on 27 May 2008 at 12:16