0

One of the specifications for an application I'm developing is that it must work with project files. My problem comes into how I'm going to fulfill this requirement because, since I'm working toward making the application as loose as possible using Prism and Unity, I can't decide on which implementation I'm going to use for the project files creation and managing (project files loading, saving, etc).

The application is going to be a SEO helper and will mostly handle text information, like Uri's and strings it will fetch from internet.

I thought of some possible implementations using:

a - The framework System.Configuration namespace. This was my first option, since I could easily plug new ConfigurationSection's into the Configuration object. The downside is that it leaves no opportunity (or at least I couldn't figure how) for using interfaces for abstraction.

b - Create a database for each project and save it in a file. With this implementation I could use a database framework such as nHibernate or any other (open to suggestions) to handle the object-to-db mapping.

c - Add your own here.

My question is, what do you guys think would be the better approach to handle different configuration/settings for every module that I plug into it and for persisting big lists of urls, lists of about 10k~100k urls as long with other settings?

Thanks in advance!

Denis Brat
  • 487
  • 5
  • 14

2 Answers2

1

The simplest way will be to define your own type (class) like ProjectSettings { ... } and simply have it serialized/deserialized with the preferred serializer (XML for example).

Then you simply don't need any fancy ORMs or configurations. Don't introduce complexity where you don't need it ;)

Alexey Raga
  • 7,457
  • 1
  • 31
  • 40
  • I really liked when you said "Don't introduce complexity where you don't need it" but it comes down to the ease of (un)serializing an settings object. Sometimes serializing a framework class is not possible and that's what happens with Uri, Dictionaries, Lists and many other types. The System.Configuration.Configuration class can easily serialize those kind of nonserializable classes, but then again it would tie the code arround concrete classes too much. Thanks anyways! – Denis Brat Jul 22 '12 at 08:09
  • Even before trying to figure out how to implement a different solution, I decided to go for serialization of the settings class. In this particular case, I decided to use the BinaryFormatter, instead of the XmlSerializer class, which also works great with interfaces and all those hard to deal with nonserializable classes, like dictionaries and so on. Finally, I'm grateful for the wise words, those which I shall remind myself from now on when I face situations of doubt like this. Thanks! – Denis Brat Jul 23 '12 at 04:54
0

Configuration file is a good solution when you have few dozen configuration variables ( But here, it 's better to have database.Why? Because if you want to do some modification on 10-100k uri, it will be hard and error will be easy. With a database (one table for project, another for string connections, another for uri..), it will be easy to query it, update it, CRUD it. you have to use database when data are to big for a file in this case because of relationship between entities (one project have many string connection, many uri...) For ORM, Entity Framework 4.0 because it is POCO (no metadata on entities class mapped). Best regard

Hassan Boutougha
  • 3,871
  • 1
  • 17
  • 17
  • I've had forgot about Entity Framework, I'll take a look at it! Still I'll be waiting for a few other suggestions before deciding which implementation to use. Thanks! – Denis Brat Jul 22 '12 at 08:11