Skip to content

Instantly share code, notes, and snippets.

@Itslet
Created December 10, 2010 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Itslet/736172 to your computer and use it in GitHub Desktop.
Save Itslet/736172 to your computer and use it in GitHub Desktop.
Piece of Global.asax.cs for Eloquera
public class MvcApplication : NinjectHttpApplication
{
public static DB db = new DB("server=(local);password=;options=none;");
private static void openSession()
{
if (File.Exists(@"c:\temp\db\iSay.eq")) {
db.OpenDatabase("iSay");
db.RegisterType(typeof(iSay.Story));
db.RegisterType(typeof(iSay.Comment));
} else {
db.CreateDatabase("iSay");
db.OpenDatabase("iSay");
db.RegisterType(typeof(iSay.Story));
db.RegisterType(typeof(iSay.Comment));
//add some dummy data
Story s = new Story {
StoryHeader = "Just another iSay weblog!",
StoryText = "Today I am so awesome.",
PostDate = DateTime.Now
};
Comment c = new Comment {
CommentText = "Oh really.",
PostDate = DateTime.Now,
PostedBy = "The Lousy Commenter",
Story = s
};
Comment c1 = new Comment
{
CommentText = "I totally agree",
PostDate = DateTime.Now,
PostedBy = "The Sweet Commenter",
Story = s
};
var comments = new List<Comment>();
comments.Add(c);
comments.Add(c1);
s.Comments = comments;
db.Store(s);
db.Store(c);
db.Store(c1);
db.Close();
openSession();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment