This project has moved and is read-only. For the latest updates, please go here.

Database creation

Nov 11, 2010 at 10:33 AM

could I use the following simplified code (as oppose to the sample where you got to maintain all those extraneous object and)

	public class RadioDB : BaseDatabaseInstance
		public override string Name { get { return "RadioDB"; } }

		protected override List<ITableDefinition> _RegisterTables()
			return new List<ITableDefinition>
				CreateTableDefinition<Radio, string>(c => c.ID),
				CreateTableDefinition<Preference, string>(c => c.Key),

		public static RadioDB Get()
			if (database == null)
				var engine = new SterlingEngine();
				var logger = new SterlingDefaultLogger(SterlingLogLevel.Information);
				database = (RadioDB)engine.SterlingDatabase.RegisterDatabase<RadioDB>();
			return database;
		static RadioDB database;

Nov 11, 2010 at 12:23 PM

This will work, but the main reason to do it as a service is to ensure that Dispose is called immediately to flush keys on exit.

Nov 11, 2010 at 12:38 PM

Yeah, I just read about Tombstoning, and it started to make sense! :)