RapidRepository of interfaces

Dec 28, 2010 at 1:29 PM

Hi... this looks a great library...

I have one question though.

Would it be possible to get RapidRepository to serialize information based on interface properties?

 

E.g. creating a repository like

public class VehicleRepository : RapidRepository<IVehicle>

 

where e.g.

public interface IVehicle

{

int TopSpeed {get; set;}

}

 

and allow me to create different implementations of IVehicles that shares storage behaviour but has different implementation logic.

 

This would allow me to create richer domain objects and still reuse the storage logic.

 

As it is now I think my best option is to use anemic dtos for storage and then rewrap the data in domain objects. It would be really awesome if that step was avoidable.

Coordinator
Jan 1, 2011 at 8:50 PM

Hi Mirtul,

Apologies it has taken so long to get back to you, I've been away for Christmas.

What your asking could possibly go onto the road map, as you can imagine it would require a much more intelligent deserialisation than what happens currently, I am going to be looking at improving the serialisation soon so I will take a look at how this could be achieved at the same time.

 

Kind Regards,

Sean.

Jan 3, 2011 at 7:47 PM

Thank you for the reply...

It would be really awesome if you found a way to make it work....

I have another question regarding serialization of objects.

Is it possible to exclude some properties from serialization using an attribute or something similar?

I was thinking something along the line of the NonSerialized Attribute.

Currently I have some properties that don't lend themselves to serialization so I'm crashing when saving the context.

I could workaround this by creating a DTO but if there's a simpler way to ignore some properties it would be great.

 

Coordinator
Jan 3, 2011 at 9:00 PM
Hi Mirtul, the nonserialized attribute will work.
Kind regards,
Sean

Sent from my Windows Phone

From: mirtul
Sent: 03 January 2011 20:47
To: sean.f.mcalinden@live.co.uk
Subject: Re: RapidRepository of interfaces [RapidRepository:239766]



> From: mirtul
>
> Thank you for the reply...It would be really awesome if you found a way to make it work....I have another question regarding serialization of objects.Is it possible to exclude some properties from serialization using an attribute or something similar?I was thinking something along the line of the NonSerialized Attribute.Currently I have some properties that don't lend themselves to serialization so I'm crashing when saving the context.I could workaround this by creating a DTO but if there's a simpler way to ignore some properties it would be great.
>
>
Jan 4, 2011 at 8:02 AM
Edited Jan 4, 2011 at 9:12 AM

Hi

I don't think the NonSerialized attribute is part of WP7.

Did you get it to work? I was assuming it was in mscorlib...

I did manage to find a way to do it though by explicitly marking my class with [DataContract] and only marking members to serialize with [DataMember]...

A little more work, but seems to do the trick.

 

Edit: IgnoreDataMemberAttribute seems to be what I was looking for.... Now it works....

Coordinator
Jan 4, 2011 at 12:13 PM

Hi Mirtul,

Apologies, you're right, it is the [System.Runtime.Serialization.IgnoreDataMember] attribute that you need to use, I knew one them was part of the framework.

Kind Regards,

Sean.