Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic AnchorPattern not marked as [Serializable] (Read 2127 times)
Dimitry
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Joined: Aug 28th, 2007
AnchorPattern not marked as [Serializable]
Aug 28th, 2007 at 10:49am
Print Post  
Hi,
I need store instances of AnchorPattern in DB. I have written simple code
Code
Select All
[Serializable]
public class ShapeStencil
{

...

private AnchorPattern _anchorPattern;

...
} 


And received exception in runtime.
I see class implemented IPersists. But this interface is internal.
How can i store AnchorPattern class?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: AnchorPattern not marked as [Serializable]
Reply #1 - Aug 28th, 2007 at 11:37am
Print Post  
Hi,

You will have to implement the serialization yourself, e.g. by implementing the ISerializable interface and (de)serializing the AnchorPattern members inside the ShapeStencil's GetObjectData method and constructor.

Stoyan
  
Back to top
 
IP Logged
 
Dimitry
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Joined: Aug 28th, 2007
Re: AnchorPattern not marked as [Serializable]
Reply #2 - Aug 28th, 2007 at 12:06pm
Print Post  
But AnchorPattern contains AnchorPointCollection and AnchorPoint. And this classes also non serializable.
If i will use your solution i have to write next
Code
Select All
[Serializable]
public class ShapeStencil
{

...

  private List<AnchorPointEx> _anchorPattern;

  private static AnchorPattern ListToPattern(List<AnchorPointEx> list)
  {}
  private static List<AnchorPointEx> PatternToList(AnchorPattern list)
  {}
...
}
[Serializable]
class AnchorPointEx
{
  public AnchorPointEx(AnchorPoint point)
  {
    // Copy all properties
  }
  // This class contains all properties as AnchorPoint
  // because AnchorPoint is sealed
}
 


I think i will make a lot of overhead work. I see two decisions:
  • Classes AnchorPattern, AnchorPointCollection and AnchorPoint mark as Serializable
  • To make AnchorPoint class as non sealed

What do you think?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: AnchorPattern not marked as [Serializable]
Reply #3 - Aug 28th, 2007 at 1:30pm
Print Post  
Ok, we can make these classes serializable, but not before we release version 5.

Stoyan
  
Back to top
 
IP Logged
 
jmquinlan
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 67
Joined: Apr 2nd, 2009
Re: AnchorPattern not marked as [Serializable]
Reply #4 - Apr 2nd, 2009 at 8:37am
Print Post  
As far as I can tell the layout classes are not marked as serialisable, is there a way around this similar to the above or is it something that you guys can fix for the next release?

The problem i have is providing customisable support for the layout parameters, without having the classes as serialisable it makes saving those layout parameters for each layout type an incredible pain in the arse..

Any help would be appreciative?
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint