Interface mapping

View: New views
7 Messages — Rating Filter:   Alert me  

Interface mapping

by Daniel Ferreira Monteiro Alves-2 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

Hi guys,

Is there a way to map an interface type to another in both ways, flex to .net and the inverse?

Example:

C# ----- > Flex

IList<T> -> ArrayCollection

Flex ------> C#

ArrayCollection ---> IList<T> or List<T> or any type that I choose that implements that interface


_______________________________________________
fluorine mailing list
fluorine@...
http://fluorine.thesilentgroup.com/mailman/listinfo/fluorine_fluorine.thesilentgroup.com

Re: Interface mapping

by Support-179 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

Hi Daniel,
 
Not in both ways:
It is safe to have a method (or VO property) that returns an interface. The AMF encoder will see the underlying type so it will be sent correctly to Flex.
 
But when the gateway receives an object from Flex and has to convert to a .NET type it is just not enough to have the (.NET) interface type. FluorineFx has to instantiate an object and from the interface no one can tell what object to create.
(And this is not even a Flex remoting specific request, it would apply to any RPC)
 
Zoli


From: fluorine-bounces@... [mailto:fluorine-bounces@...] On Behalf Of Daniel Alves
Sent: Friday, May 02, 2008 6:01 AM
To: Fluorine Mailing List
Subject: [Fluorine] Interface mapping

Hi guys,

Is there a way to map an interface type to another in both ways, flex to .net and the inverse?

Example:

C# ----- > Flex

IList<T> -> ArrayCollection

Flex ------> C#

ArrayCollection ---> IList<T> or List<T> or any type that I choose that implements that interface


_______________________________________________
fluorine mailing list
fluorine@...
http://fluorine.thesilentgroup.com/mailman/listinfo/fluorine_fluorine.thesilentgroup.com

Re: Interface mapping

by Samuel Neff :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

It would be nice though if Fluorine provided some methodology for doing this.  Two options would be to provide a mapping of interfaces to concrete classes within a config, like:

<interfaceMap>
  <map interface="IList<T>" class="List<T>" />
  <map interface="IDictionary<TKey, TValue>" class="Dictionary<TKey, TValue>" />
</interfaceMap>

or use an attribute on the individual properties (less desirable due to repetition)

[InstantiateInterfaceAs(typeof(List<DataItem>))]
public IList<DataItem> Data { get; set; }

We use concrete List<> collections in all of our data object but have definitely run into situations where it would have been preferrable to use IList<T> even if upon receive Fluorine always created them as List<T>.

Thanks,

Sam



On Fri, May 2, 2008 at 7:48 AM, Support <support@...> wrote:
Hi Daniel,
 
Not in both ways:
It is safe to have a method (or VO property) that returns an interface. The AMF encoder will see the underlying type so it will be sent correctly to Flex.
 
But when the gateway receives an object from Flex and has to convert to a .NET type it is just not enough to have the (.NET) interface type. FluorineFx has to instantiate an object and from the interface no one can tell what object to create.
(And this is not even a Flex remoting specific request, it would apply to any RPC)
 
Zoli



--
-----------------------------------------------------------------
We're Hiring! Seeking passionate Flex, C#, or C++ (RTSP, H264) developer. Position is in the Washington D.C. metro area. Contact careers@...
_______________________________________________
fluorine mailing list
fluorine@...
http://fluorine.thesilentgroup.com/mailman/listinfo/fluorine_fluorine.thesilentgroup.com

Re: Interface mapping

by Support-179 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

Hi Sam,
 
Actually attributes sound "safer".
I do not expect a big success for developers configuring typenames like: class="System.Collections.Generic.List`1[ServiceLibrary.SomeVO]" :)
 
Will consider this request
Zoli


From: fluorine-bounces@... [mailto:fluorine-bounces@...] On Behalf Of Samuel Neff
Sent: Friday, May 02, 2008 4:24 PM
To: Fluorine Mailing List
Subject: Re: [Fluorine] Interface mapping

It would be nice though if Fluorine provided some methodology for doing this.  Two options would be to provide a mapping of interfaces to concrete classes within a config, like:

<interfaceMap>
  <map interface="IList<T>" class="List<T>" />
  <map interface="IDictionary<TKey, TValue>" class="Dictionary<TKey, TValue>" />
</interfaceMap>

or use an attribute on the individual properties (less desirable due to repetition)

[InstantiateInterfaceAs(typeof(List<DataItem>))]
public IList<DataItem> Data { get; set; }

We use concrete List<> collections in all of our data object but have definitely run into situations where it would have been preferrable to use IList<T> even if upon receive Fluorine always created them as List<T>.

Thanks,

Sam



On Fri, May 2, 2008 at 7:48 AM, Support <support@...> wrote:
Hi Daniel,
 
Not in both ways:
It is safe to have a method (or VO property) that returns an interface. The AMF encoder will see the underlying type so it will be sent correctly to Flex.
 
But when the gateway receives an object from Flex and has to convert to a .NET type it is just not enough to have the (.NET) interface type. FluorineFx has to instantiate an object and from the interface no one can tell what object to create.
(And this is not even a Flex remoting specific request, it would apply to any RPC)
 
Zoli



--
-----------------------------------------------------------------
We're Hiring! Seeking passionate Flex, C#, or C++ (RTSP, H264) developer. Position is in the Washington D.C. metro area. Contact careers@...
_______________________________________________
fluorine mailing list
fluorine@...
http://fluorine.thesilentgroup.com/mailman/listinfo/fluorine_fluorine.thesilentgroup.com

Re: Interface mapping

by Daniel Ferreira Monteiro Alves-2 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

Ok... I just want to simplify the things but for the way I will have to made a proxy or façade for every domain object that I want to send to the Flex... just to hide some properties or mark them with the Transient attribute... what I don't want to, because I will put a direct dependency in my domain classes to the fluorine... so if possible, can we separate the fluorine into two assemblies?

- Fluorine.Attributes (that contains only the attributes)
- Fluorine

That way will be no problem to do a direct dependecy from any domain model.

I have made a object generator that generates all my classes from the domain in AS3. I am  thinking to put this project on the source forge to simplify the things... it generates all domain classes and controllers for the cairngorm, but I will make a refactor before, that way any person can contribute with "plugins".

BUG or at least can be one... I marked a class with TransferObject, that class has a field with a Transient attribute... the compilation worked, but after that the ServiceBrowser don't.

2008/5/2 Support <support@...>:
Hi Sam,
 
Actually attributes sound "safer".
I do not expect a big success for developers configuring typenames like: class="System.Collections.Generic.List`1[ServiceLibrary.SomeVO]" :)
 
Will consider this request
Zoli


From: fluorine-bounces@... [mailto:fluorine-bounces@...] On Behalf Of Samuel Neff
Sent: Friday, May 02, 2008 4:24 PM
To: Fluorine Mailing List
Subject: Re: [Fluorine] Interface mapping

It would be nice though if Fluorine provided some methodology for doing this.  Two options would be to provide a mapping of interfaces to concrete classes within a config, like:

<interfaceMap>
  <map interface="IList<T>" class="List<T>" />
  <map interface="IDictionary<TKey, TValue>" class="Dictionary<TKey, TValue>" />
</interfaceMap>

or use an attribute on the individual properties (less desirable due to repetition)

[InstantiateInterfaceAs(typeof(List<DataItem>))]
public IList<DataItem> Data { get; set; }

We use concrete List<> collections in all of our data object but have definitely run into situations where it would have been preferrable to use IList<T> even if upon receive Fluorine always created them as List<T>.

Thanks,

Sam



On Fri, May 2, 2008 at 7:48 AM, Support <support@...> wrote:
Hi Daniel,
 
Not in both ways:
It is safe to have a method (or VO property) that returns an interface. The AMF encoder will see the underlying type so it will be sent correctly to Flex.
 
But when the gateway receives an object from Flex and has to convert to a .NET type it is just not enough to have the (.NET) interface type. FluorineFx has to instantiate an object and from the interface no one can tell what object to create.
(And this is not even a Flex remoting specific request, it would apply to any RPC)
 
Zoli



--
-----------------------------------------------------------------
We're Hiring! Seeking passionate Flex, C#, or C++ (RTSP, H264) developer. Position is in the Washington D.C. metro area. Contact careers@...

_______________________________________________
fluorine mailing list
fluorine@...
http://fluorine.thesilentgroup.com/mailman/listinfo/fluorine_fluorine.thesilentgroup.com



_______________________________________________
fluorine mailing list
fluorine@...
http://fluorine.thesilentgroup.com/mailman/listinfo/fluorine_fluorine.thesilentgroup.com

Re: Interface mapping

by Support-179 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

Generally I would choose an existing attribute from the framework, but unfortunately the NonSerializable applies to fields only (FluorineFx checks this one too).
Also properties remain hidden for serialization if they are private. Btw why should we have public VO/TO properties that should not be transferred? :)
 
Before somebody will think that I am a lame software architect :) I have to explain that the reason why Fluorine tends to be monolithic is to further cut support hours :)
That is not everyone is using VS.NET wizardry where the IDE would always take care to refresh assembly dependencies and to deploy dependencies correctly.
 
Zoli


From: fluorine-bounces@... [mailto:fluorine-bounces@...] On Behalf Of Daniel Alves
Sent: Friday, May 02, 2008 11:35 PM
To: Fluorine Mailing List
Subject: Re: [Fluorine] Interface mapping

Ok... I just want to simplify the things but for the way I will have to made a proxy or façade for every domain object that I want to send to the Flex... just to hide some properties or mark them with the Transient attribute... what I don't want to, because I will put a direct dependency in my domain classes to the fluorine... so if possible, can we separate the fluorine into two assemblies?

- Fluorine.Attributes (that contains only the attributes)
- Fluorine

That way will be no problem to do a direct dependecy from any domain model.

I have made a object generator that generates all my classes from the domain in AS3. I am  thinking to put this project on the source forge to simplify the things... it generates all domain classes and controllers for the cairngorm, but I will make a refactor before, that way any person can contribute with "plugins".

BUG or at least can be one... I marked a class with TransferObject, that class has a field with a Transient attribute... the compilation worked, but after that the ServiceBrowser don't.

2008/5/2 Support <support@...>:
Hi Sam,
 
Actually attributes sound "safer".
I do not expect a big success for developers configuring typenames like: class="System.Collections.Generic.List`1[ServiceLibrary.SomeVO]" :)
 
Will consider this request
Zoli


From: fluorine-bounces@... [mailto:fluorine-bounces@...] On Behalf Of Samuel Neff
Sent: Friday, May 02, 2008 4:24 PM
To: Fluorine Mailing List
Subject: Re: [Fluorine] Interface mapping

It would be nice though if Fluorine provided some methodology for doing this.  Two options would be to provide a mapping of interfaces to concrete classes within a config, like:

<interfaceMap>
  <map interface="IList<T>" class="List<T>" />
  <map interface="IDictionary<TKey, TValue>" class="Dictionary<TKey, TValue>" />
</interfaceMap>

or use an attribute on the individual properties (less desirable due to repetition)

[InstantiateInterfaceAs(typeof(List<DataItem>))]
public IList<DataItem> Data { get; set; }

We use concrete List<> collections in all of our data object but have definitely run into situations where it would have been preferrable to use IList<T> even if upon receive Fluorine always created them as List<T>.

Thanks,

Sam



On Fri, May 2, 2008 at 7:48 AM, Support <support@...> wrote:
Hi Daniel,
 
Not in both ways:
It is safe to have a method (or VO property) that returns an interface. The AMF encoder will see the underlying type so it will be sent correctly to Flex.
 
But when the gateway receives an object from Flex and has to convert to a .NET type it is just not enough to have the (.NET) interface type. FluorineFx has to instantiate an object and from the interface no one can tell what object to create.
(And this is not even a Flex remoting specific request, it would apply to any RPC)
 
Zoli



--
-----------------------------------------------------------------
We're Hiring! Seeking passionate Flex, C#, or C++ (RTSP, H264) developer. Position is in the Washington D.C. metro area. Contact careers@...

_______________________________________________
fluorine mailing list
fluorine@...
http://fluorine.thesilentgroup.com/mailman/listinfo/fluorine_fluorine.thesilentgroup.com



_______________________________________________
fluorine mailing list
fluorine@...
http://fluorine.thesilentgroup.com/mailman/listinfo/fluorine_fluorine.thesilentgroup.com

Re: Interface mapping

by Daniel Ferreira Monteiro Alves-2 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

OK then! :P

2008/5/2 Support <support@...>:
Generally I would choose an existing attribute from the framework, but unfortunately the NonSerializable applies to fields only (FluorineFx checks this one too).
Also properties remain hidden for serialization if they are private. Btw why should we have public VO/TO properties that should not be transferred? :)
 
Before somebody will think that I am a lame software architect :) I have to explain that the reason why Fluorine tends to be monolithic is to further cut support hours :)
That is not everyone is using VS.NET wizardry where the IDE would always take care to refresh assembly dependencies and to deploy dependencies correctly.
 
Zoli


From: fluorine-bounces@... [mailto:fluorine-bounces@...] On Behalf Of Daniel Alves
Sent: Friday, May 02, 2008 11:35 PM

To: Fluorine Mailing List
Subject: Re: [Fluorine] Interface mapping

Ok... I just want to simplify the things but for the way I will have to made a proxy or façade for every domain object that I want to send to the Flex... just to hide some properties or mark them with the Transient attribute... what I don't want to, because I will put a direct dependency in my domain classes to the fluorine... so if possible, can we separate the fluorine into two assemblies?

- Fluorine.Attributes (that contains only the attributes)
- Fluorine

That way will be no problem to do a direct dependecy from any domain model.

I have made a object generator that generates all my classes from the domain in AS3. I am  thinking to put this project on the source forge to simplify the things... it generates all domain classes and controllers for the cairngorm, but I will make a refactor before, that way any person can contribute with "plugins".

BUG or at least can be one... I marked a class with TransferObject, that class has a field with a Transient attribute... the compilation worked, but after that the ServiceBrowser don't.

2008/5/2 Support <support@...>:
Hi Sam,
 
Actually attributes sound "safer".
I do not expect a big success for developers configuring typenames like: class="System.Collections.Generic.List`1[ServiceLibrary.SomeVO]" :)
 
Will consider this request
Zoli


From: fluorine-bounces@... [mailto:fluorine-bounces@...] On Behalf Of Samuel Neff
Sent: Friday, May 02, 2008 4:24 PM
To: Fluorine Mailing List
Subject: Re: [Fluorine] Interface mapping

It would be nice though if Fluorine provided some methodology for doing this.  Two options would be to provide a mapping of interfaces to concrete classes within a config, like:

<interfaceMap>
  <map interface="IList<T>" class="List<T>" />
  <map interface="IDictionary<TKey, TValue>" class="Dictionary<TKey, TValue>" />
</interfaceMap>

or use an attribute on the individual properties (less desirable due to repetition)

[InstantiateInterfaceAs(typeof(List<DataItem>))]
public IList<DataItem> Data { get; set; }

We use concrete List<> collections in all of our data object but have definitely run into situations where it would have been preferrable to use IList<T> even if upon receive Fluorine always created them as List<T>.

Thanks,

Sam



On Fri, May 2, 2008 at 7:48 AM, Support <support@...> wrote:
Hi Daniel,
 
Not in both ways:
It is safe to have a method (or VO property) that returns an interface. The AMF encoder will see the underlying type so it will be sent correctly to Flex.
 
But when the gateway receives an object from Flex and has to convert to a .NET type it is just not enough to have the (.NET) interface type. FluorineFx has to instantiate an object and from the interface no one can tell what object to create.
(And this is not even a Flex remoting specific request, it would apply to any RPC)
 
Zoli



--
-----------------------------------------------------------------
We're Hiring! Seeking passionate Flex, C#, or C++ (RTSP, H264) developer. Position is in the Washington D.C. metro area. Contact careers@...

_______________________________________________
fluorine mailing list
fluorine@...
http://fluorine.thesilentgroup.com/mailman/listinfo/fluorine_fluorine.thesilentgroup.com



_______________________________________________
fluorine mailing list
fluorine@...
http://fluorine.thesilentgroup.com/mailman/listinfo/fluorine_fluorine.thesilentgroup.com



_______________________________________________
fluorine mailing list
fluorine@...
http://fluorine.thesilentgroup.com/mailman/listinfo/fluorine_fluorine.thesilentgroup.com