This project is read-only.

Can i Hold States and Cities list in static class instead of database?

Topics: Writing modules
Jun 16, 2014 at 11:25 PM
I want to hold Code and Name of about 3000 States and Cities in C# static class instead of table in db. I want to use this class in shop module.
May i face problem with this way?
Can anyone compare performance between list in static class and table in database?

Please guide me.
Jun 17, 2014 at 12:27 PM
You can do this and if you just read values from a static class (or have just pure static methods) than you don't have anything special in Orchard on top of what you usually have with static classes. If you're also writing to static members you have to keep Orchard's multi-tenancy in mind, since static values are shared across the whole application.

You have to check performance for your specific use-case yourself, but most possibly using the static class will be faster, since it sits in memory (for the same reason search or lookup will most possibly also faster if you use appropriate data structures) but naturally this costs some memory.
Marked as answer by mehranrezaei on 6/17/2014 at 4:41 AM
Jun 17, 2014 at 12:41 PM
Very very thank you.