1

I am newbie to servicestack and ormlite.

I am trying to have fields to be used for displaying / serialization purposes not for persistance purposes. I tried [ignoredatamemebr] but this ignore both persistance and serialization. I want to do something similar to [notmapped] in entity framework and like @transient in hibernate.

madhead
  • 28,732
  • 15
  • 145
  • 186
Shaheen
  • 141
  • 2
  • 6

1 Answers1

2

Use the [Ignore] attribute to ignore properties from being persisted in OrmLite.

Whilst here are different ways to ignore properties during serialization.

Community
  • 1
  • 1
mythz
  • 138,929
  • 27
  • 237
  • 382
  • Sorry of being late due to work load at my day job. Thanks for your fast response. Unfortunately, I tested all possibilities in the provided link but it did not work as I expected. I wanted to reuse the DTO that I used for creating table with extra information (description fields for foreign keys (Ids)) to be returned for view purposes which is similar to ViewModel in MVC applications. I can create viewModel instead of reuse the DTO but I am in learning process and I want to discover opportunities to reuse code. – Shaheen Oct 21 '13 at 21:19
  • @Shaheen The recommendation is [not to re-use DTO's](http://stackoverflow.com/a/15369736/85785) but as stated, `[Ignore]` is how to get OrmLite to ignore properties, just as your question asked. – mythz Oct 21 '13 at 21:22
  • thanks for great references. Your help is highly appreciated. – Shaheen Oct 22 '13 at 17:44