diff --git a/.gitignore b/.gitignore
index 49f18f2..d0993a7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,9 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
+# additions by alec (tm)
+connectionStrings.config
+
# User-specific files
*.suo
*.user
diff --git a/server/App.config b/server/App.config
index 6d745b8..c5270de 100644
--- a/server/App.config
+++ b/server/App.config
@@ -14,32 +14,18 @@
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/server/CircleScape.csproj b/server/CircleScape.csproj
index 4453134..3ad683c 100644
--- a/server/CircleScape.csproj
+++ b/server/CircleScape.csproj
@@ -49,27 +49,17 @@
packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll
-
- packages\log4net.2.0.5\lib\net45-full\log4net.dll
+
+ packages\MySql.Data.6.9.9\lib\net45\MySql.Data.dll
+ True
+
+
+ packages\MySql.Data.Entity.6.9.9\lib\net45\MySql.Data.Entity.EF6.dll
+ True
-
- packages\System.Data.SQLite.Core.1.0.105.0\lib\net46\System.Data.SQLite.dll
- True
-
-
- packages\System.Data.SQLite.EF6.1.0.105.0\lib\net46\System.Data.SQLite.EF6.dll
- True
-
-
- packages\System.Data.SQLite.EF6.Migrations.1.0.104\lib\System.Data.SQLite.EF6.Migrations.dll
-
-
- packages\System.Data.SQLite.Linq.1.0.105.0\lib\net46\System.Data.SQLite.Linq.dll
- True
-
@@ -81,13 +71,15 @@
-
-
-
+
+
+ 201706040437361_Initial.cs
+
+
@@ -99,6 +91,10 @@
Designer
+
+ Designer
+ App.config
+
Designer
App.config
@@ -129,13 +125,16 @@
Square
+
+
+ 201706040437361_Initial.cs
+
+
-
This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
diff --git a/server/DAL/ItemDefinition.cs b/server/DAL/ItemDefinition.cs
deleted file mode 100644
index fbd0e66..0000000
--- a/server/DAL/ItemDefinition.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-using System.Data.Entity.Spatial;
-
-namespace CircleScape.DAL {
- public partial class ItemDefinition {
- public long Id { get; set; }
-
- [Required]
- public string Name { get; set; }
-
- [Required]
- public string Sheet { get; set; }
- public long Offset { get; set; }
-
- public bool Stackable { get; set; } = false;
-
- public virtual ICollection- Items { get; set; }
- }
-}
diff --git a/server/DAL/Item.cs b/server/DAL/Origin.cs
similarity index 57%
rename from server/DAL/Item.cs
rename to server/DAL/Origin.cs
index b5d0fe7..31f3453 100644
--- a/server/DAL/Item.cs
+++ b/server/DAL/Origin.cs
@@ -6,17 +6,13 @@ using System.Text;
using System.Threading.Tasks;
namespace CircleScape.DAL {
- public class Item {
+ public partial class Origin {
public long Id { get; set; }
- [Index("ItemItemDefinitionId")]
- public long DefinitionId { get; set; }
- public virtual ItemDefinition Definition { get; set; }
-
- [Index("ItemUserId")]
+ [ForeignKey("User")]
public long UserId { get; set; }
public virtual User User { get; set; }
- public long Quantity { get; set; }
+ public string Ip { get; set; }
}
}
diff --git a/server/DAL/ScapeDb.cs b/server/DAL/ScapeDb.cs
index 857abca..7433be0 100644
--- a/server/DAL/ScapeDb.cs
+++ b/server/DAL/ScapeDb.cs
@@ -1,55 +1,27 @@
-using System;
-using System.Data.Entity;
-using System.ComponentModel.DataAnnotations.Schema;
-using System.Linq;
-using System.Data.Entity.Migrations;
-using System.Data.SQLite.EF6.Migrations;
-
namespace CircleScape.DAL {
+ using System;
+ using System.Data.Entity;
+ using System.ComponentModel.DataAnnotations.Schema;
+ using System.Linq;
+
+ [DbConfigurationType(typeof(MySql.Data.Entity.MySqlEFConfiguration))]
public partial class ScapeDb : DbContext {
static ScapeDb() {
- Database.SetInitializer(
- new MigrateDatabaseToLatestVersion(true)
- );
+ DbConfiguration.SetConfiguration(new MySql.Data.Entity.MySqlEFConfiguration());
}
-
- public ScapeDb() : base("name=Database") {
+
+ public ScapeDb()
+ : base("name=ScapeDbDebug")
+ {
}
- public virtual DbSet Sessions { get; set; }
- public virtual DbSet Users { get; set; }
- public virtual DbSet
- Items { get; set; }
- public virtual DbSet ItemDefinitions { get; set; }
+ public DbSet Users { get; set; }
+ public DbSet Origins { get; set; }
+
protected override void OnModelCreating(DbModelBuilder modelBuilder) {
- modelBuilder.Entity()
- .HasMany(e => e.Sessions)
- .WithRequired(e => e.User)
- .HasForeignKey(e => e.UserId)
- .WillCascadeOnDelete(true);
-
- modelBuilder.Entity()
- .HasMany(e => e.Items)
- .WithRequired(e => e.User)
- .HasForeignKey(e => e.UserId)
- .WillCascadeOnDelete(true);
-
- modelBuilder.Entity()
- .HasMany(e => e.Items)
- .WithRequired(e => e.Definition)
- .HasForeignKey(e => e.DefinitionId)
- .WillCascadeOnDelete(true);
- }
- }
-
- internal sealed class ScapeDbMigrationConfig
- : DbMigrationsConfiguration
- {
- public ScapeDbMigrationConfig() {
- AutomaticMigrationsEnabled = true;
- AutomaticMigrationDataLossAllowed = true;
- SetSqlGenerator("System.Data.SQLite", new SQLiteMigrationSqlGenerator());
+ base.OnModelCreating(modelBuilder);
}
}
}
diff --git a/server/DAL/Server.cs b/server/DAL/Server.cs
new file mode 100644
index 0000000..13f7415
--- /dev/null
+++ b/server/DAL/Server.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CircleScape.DAL {
+ class Server {
+ public int Id { get; set; }
+
+ }
+}
diff --git a/server/DAL/Session.cs b/server/DAL/Session.cs
index 1758665..d487e42 100644
--- a/server/DAL/Session.cs
+++ b/server/DAL/Session.cs
@@ -1,18 +1,18 @@
-using System;
+using System;
using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
-using System.Data.Entity.Spatial;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
namespace CircleScape.DAL {
public partial class Session {
public long Id { get; set; }
- [Index("SessionUserId")]
- public long UserId { get; set; }
+ [ForeignKey("User")]
+ public int UserId { get; set; }
public virtual User User { get; set; }
- [Required]
- public string IpAddress { get; set; }
+
}
}
diff --git a/server/DAL/User.cs b/server/DAL/User.cs
index d29bac4..f94f5a6 100644
--- a/server/DAL/User.cs
+++ b/server/DAL/User.cs
@@ -1,8 +1,9 @@
-using System;
+using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-using System.Data.Entity.Spatial;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
namespace CircleScape.DAL {
public partial class User {
@@ -14,16 +15,10 @@ namespace CircleScape.DAL {
[Required]
public string Password { get; set; }
- public long? Joined { get; set; }
-
- public long? LastLogin { get; set; }
-
[Required]
- public string JoinedIp { get; set; }
-
- public string LastIp { get; set; }
-
- public virtual ICollection Sessions { get; set; }
- public virtual ICollection
- Items { get; set; }
+ public DateTime Joined { get; set; }
+ public DateTime? LastLogin { get; set; }
+
+ public virtual ICollection Origins { get; set; }
}
}
diff --git a/server/Entrypoint.cs b/server/Entrypoint.cs
index 9f3171d..e02d8d7 100644
--- a/server/Entrypoint.cs
+++ b/server/Entrypoint.cs
@@ -1,19 +1,15 @@
using System;
using System.Collections.Generic;
-using System.Data.SQLite;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using CircleScape.DAL;
+//using CircleScape.DAL;
using System.Numerics;
using Square;
namespace CircleScape {
class Entrypoint {
static void Main(string[] args) {
- var db = new ScapeDb();
- var users = db.Users.ToList();
-
var server = new Kneesocks.Server(6770, PoolManager.Pending);
server.Start();
diff --git a/server/Migrations/201706040437361_Initial.Designer.cs b/server/Migrations/201706040437361_Initial.Designer.cs
new file mode 100644
index 0000000..33c7e11
--- /dev/null
+++ b/server/Migrations/201706040437361_Initial.Designer.cs
@@ -0,0 +1,29 @@
+//
+namespace CircleScape.Migrations
+{
+ using System.CodeDom.Compiler;
+ using System.Data.Entity.Migrations;
+ using System.Data.Entity.Migrations.Infrastructure;
+ using System.Resources;
+
+ [GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
+ public sealed partial class Initial : IMigrationMetadata
+ {
+ private readonly ResourceManager Resources = new ResourceManager(typeof(Initial));
+
+ string IMigrationMetadata.Id
+ {
+ get { return "201706040437361_Initial"; }
+ }
+
+ string IMigrationMetadata.Source
+ {
+ get { return null; }
+ }
+
+ string IMigrationMetadata.Target
+ {
+ get { return Resources.GetString("Target"); }
+ }
+ }
+}
diff --git a/server/Migrations/201706040437361_Initial.cs b/server/Migrations/201706040437361_Initial.cs
new file mode 100644
index 0000000..c85cc5e
--- /dev/null
+++ b/server/Migrations/201706040437361_Initial.cs
@@ -0,0 +1,28 @@
+namespace CircleScape.Migrations
+{
+ using System;
+ using System.Data.Entity.Migrations;
+
+ public partial class Initial : DbMigration
+ {
+ public override void Up()
+ {
+ CreateTable(
+ "dbo.Users",
+ c => new
+ {
+ Id = c.Long(nullable: false, identity: true),
+ Username = c.String(nullable: false, unicode: false),
+ Password = c.String(nullable: false, unicode: false),
+ Joined = c.DateTime(nullable: false, precision: 0),
+ })
+ .PrimaryKey(t => t.Id);
+
+ }
+
+ public override void Down()
+ {
+ DropTable("dbo.Users");
+ }
+ }
+}
diff --git a/server/Migrations/201706040437361_Initial.resx b/server/Migrations/201706040437361_Initial.resx
new file mode 100644
index 0000000..7805a95
--- /dev/null
+++ b/server/Migrations/201706040437361_Initial.resx
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ H4sIAAAAAAAEAM1X3W7bNhS+H7B3IHidik67Dlsgt8jsZMgWJ0aV9p6WjhViFKmRVGo/2y72SH2FHurfkp04WVEMARyZOuc73/mnv/zzb/h+k0nyAMYKrab0NJhQAirWiVDplBZu/eoX+v7djz+EF0m2IZ8auTdeDjWVndJ75/Izxmx8Dxm3QSZio61euyDWGeOJZq8nk1/Z6SkDhKCIRUj4oVBOZFB+wa8zrWLIXcHlQicgbX2Ob6ISldzwDGzOY5jSmTCxhCjmOQTz82tKzqXgSCMCuaaEK6Udd0jy7KOFyBmt0ijHAy7vtjmg3JpLCzX5s078WD8mr70frFNsoOLCOp09E/D0TR0YNlR/UXhpGzgM3QWG2G2912X4phQDYigZGjqbSeOFRpENvPwJwY8H/7/JPZaI/zshs0K6wsBUQeEMlydkWaykiP+E7Z3+C9RUFVL2CSElfLdzgEdLo3MwbvsB1jXNq4QStqvHhoqtWk+ncuJKuZ9/ouQGjfOVhDbfPYcjpw38DgoMd5AsuXNglMeAMmIj6wNbPiwKnxqLWGTYLJQs+OYaVOrupxQfKbkUG0iak5rFRyWwt1DJmQL2sHzc8pJb+1mb5Ptb/kMLBa3dOcbtTmRPwYSsK8FxYWLPO46opjZR1t18tadAMeB1jdqa/i7XCi8C10uQpaQzXg2HoKr/fQxbLt3gYdXkaSYUOzCiwgXPc0xCb2TVJySq59Wr6Pm9nFUYLLZ7Wrpl21rCguYpDN6iaWR6KYx1mDC+4j4/syQbiTWRPxDVxko/uMMu7mLdSPvnSmPfWBkCdGG7RE8ybMTSKWhJ1NNrpFauCC652TMQZloWmTo0VB7T7lq8j9GdHo/UtWwfqTs9HqlpwT5OczZGCdkgnsOMsVHKBiN3mP/H2mYo0lpv22fQJmFdskes+2ENVyKUYHgeROLrd7GN/paBfx+UjzMp0OFOYsGVWIN11Vqib4O3g0vD/2eBM2sTecQW/+5rdSVS4WP65O585mIZLlOJ9zUHG/efd+OLgXZXXYJuunLVLQ3Eorr9Tr7p4htP6afX28HtVnUH8l5pdKFiWO/DFy6+caeGrH99D+dgRdpB+Mu8gti3QAfayFyptW7ijR71GTUig3QswHFMAj83Tqx57PB1DNaW955PXBYocpGtILlSt4XLC3duLWQruXOLC9nj9svtvss5vM39N/stXECawtfRrfqtEDJpeV/uqZwDEL5G6q5DVnjvQ7h02yLdaHUkUB2+OeSgfM/eQZZLBLO3KuIP8BJuWF7XkPJ428zbwyBPJ2I37OFc8NTwzNYYnb7/Scr8b9J3XwEmjKgcxQ4AAA==
+
+
+ dbo
+
+
\ No newline at end of file
diff --git a/server/Migrations/Configuration.cs b/server/Migrations/Configuration.cs
new file mode 100644
index 0000000..d299984
--- /dev/null
+++ b/server/Migrations/Configuration.cs
@@ -0,0 +1,32 @@
+namespace CircleScape.Migrations
+{
+ using System;
+ using System.Data.Entity;
+ using System.Data.Entity.Migrations;
+ using System.Linq;
+
+ internal sealed class Configuration : DbMigrationsConfiguration
+ {
+ public Configuration()
+ {
+ SetSqlGenerator("MySql.Data.MySqlClient", new MySql.Data.Entity.MySqlMigrationSqlGenerator());
+ AutomaticMigrationsEnabled = false;
+ }
+
+ protected override void Seed(CircleScape.DAL.ScapeDb context)
+ {
+ // This method will be called after migrating to the latest version.
+
+ // You can use the DbSet.AddOrUpdate() helper extension method
+ // to avoid creating duplicate seed data. E.g.
+ //
+ // context.People.AddOrUpdate(
+ // p => p.FullName,
+ // new Person { FullName = "Andrew Peters" },
+ // new Person { FullName = "Brice Lambson" },
+ // new Person { FullName = "Rowan Miller" }
+ // );
+ //
+ }
+ }
+}
diff --git a/server/packages.config b/server/packages.config
index 450a5e4..e535184 100644
--- a/server/packages.config
+++ b/server/packages.config
@@ -3,10 +3,6 @@
-
-
-
-
-
-
+
+
\ No newline at end of file