Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class User
- {
- [AutoIncrement] // Creates Auto primary key
- public int Id { get; set; }
- public string Username { get; set; }
- public string Email { get; set; }
- public string Password { get; set; }
- public bool IsPremium{ get; set; }
- public DateTime? LastUpdated { get; set; }
- }
- class Relationship
- {
- public int User_one_id { get; set; } // FK User.Id
- public int User_two_id { get; set; } // FK User.Id
- public int Status { get; set; }
- public int Action_user_id{ get; set; }
- }
- class Claim
- {
- [AutoIncrement] // Creates Auto primary key
- public int Id { get; set; }
- public int User_one_id { get; set; } // FK User.Id
- public int User_two_id { get; set; } // FK User.Id
- public int Object_id { get; set; } // FK Object.Id
- public int Object_count { get; set; }
- public DateTime? LastUpdated { get; set; };
- }
- class Object
- {
- [AutoIncrement] // Creates Auto primary key
- public int Id { get; set; }
- public string LongName { get; set; }
- public string ShortName { get; set; }
- public string Description { get; set; }
- }
- ================================================================================================
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using ServiceStack.DataAnnotations;
- using ServiceStack.OrmLite;
- using ServiceStack.OrmLite.Sqlite;
- using System.Data;
- using ServiceStack.Common.Utils;
- public void addUserToDb() {
- public static string SqliteMemoryDb = ":memory:";
- public static string SqliteFileDb = "~/App_Data/db.sqlite".MapAbsolutePath();
- //Using Sqlite DB
- var dbFactory = new OrmLiteConnectionFactory(
- SqliteFileDb, false, SqliteDialect.Provider);
- using (var db = dbFactory.Open()) {
- db.CreateTableIfNotExists<User>();
- // Insert
- db.Insert(
- new User {
- Username = Username ,
- Email = "ampedpf@ct.com",
- Password = "password1",
- IsPremium = true,
- LastUpdated = new DateTime(2015, 1, 5) });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement