Subsonic Simple Repository String Lengths

154 views Asked by At

I'm playing around with the SimpleRepository provider (with automigrations) in SubSonic 3 and I have an annoying problem:

The only way I can control the string length in my database tables is by adding the SubSonicStringLength or SubSonicLongString attributes to the properties of the objects that need to be persisted.

I don't really want a dependency on SubSonic anywhere except in my repository class, and certainly not in my model objects if I can avoid it.

Are there anyways to get round this or am I stuck using SubSonicStringLength and the other attributes?

1

There are 1 answers

0
Adam Cooper On BEST ANSWER

Basically the only way around this would be to have a DTO object that you map to/from your SimpleRepository classes inside your repository. You could use a mapping tool like AutoMapper to convert to/from your DTOs to your SimpleRepo objects. This would isolate your application from SubSonic dependencies outside of your repo but would obviously involve a non trivial amount of work.