Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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