diff --git a/.gitignore b/.gitignore index dddf2a5..d0262fb 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. +# Visual Studio 2015 cache/options directory +.vs/ + # Specific _git/ /SSL/ @@ -202,6 +205,7 @@ FakesAssemblies/ # Visual Studio 6 workspace options file *.opt + ### Windows ### # Windows image file caches Thumbs.db diff --git a/src/Core/DAL/Rambler.Cinema.DAL.Entities/BaseEntity.cs b/src/Core/DAL/Rambler.Cinema.DAL.Entities/BaseEntity.cs index 2f2920f..206295d 100644 --- a/src/Core/DAL/Rambler.Cinema.DAL.Entities/BaseEntity.cs +++ b/src/Core/DAL/Rambler.Cinema.DAL.Entities/BaseEntity.cs @@ -4,7 +4,7 @@ namespace Rambler.Cinema.DAL.Entities { public class BaseEntity - { + { [Timestamp] public byte[] TimeStamp { get; set; } diff --git a/src/Core/DAL/Rambler.Cinema.DAL.Entities/ContactPerson.cs b/src/Core/DAL/Rambler.Cinema.DAL.Entities/ContactPerson.cs index b7f5928..eb3c618 100644 --- a/src/Core/DAL/Rambler.Cinema.DAL.Entities/ContactPerson.cs +++ b/src/Core/DAL/Rambler.Cinema.DAL.Entities/ContactPerson.cs @@ -7,8 +7,7 @@ namespace Rambler.Cinema.DAL.Entities { [DebuggerDisplay("{DebuggerDisplay,nq}")] public class ContactPerson: Person - { - + { ICollection _phones; public virtual ICollection Phones { @@ -23,14 +22,13 @@ public virtual ICollection Phones public virtual int DepartmentId { get; set; } [ForeignKey("DepartmentId")] [Required] - public virtual Department Department { get; set; } - + public virtual Department Department { get; set; } - ICollection _cinemas; + ICollection _cinema; public virtual ICollection Cinemas { - get { return _cinemas ?? (_cinemas = new List()); } - set { _cinemas = value; } + get { return _cinema ?? (_cinema = new List()); } + set { _cinema = value; } } string DebuggerDisplay => $"{GivenName} {MiddleName} {SurName}: {Title} in {Department?.Name}"; diff --git a/src/Core/DAL/Rambler.Cinema.DAL.Entities/ICinemaDbContext.cs b/src/Core/DAL/Rambler.Cinema.DAL.Entities/ICinemaDbContext.cs index 4efeb39..521a952 100644 --- a/src/Core/DAL/Rambler.Cinema.DAL.Entities/ICinemaDbContext.cs +++ b/src/Core/DAL/Rambler.Cinema.DAL.Entities/ICinemaDbContext.cs @@ -8,6 +8,7 @@ public interface ICinemaDbContext DbSet
Addresses { get; set; } DbSet Departments { get; set; } DbSet Persons { get; set; } + DbSet ContactPersons { get; set; } DbSet Phones { get; set; } DbSet Genres { get; set; } diff --git a/src/Core/DAL/Rambler.Cinema.DAL.Entities/Phone.cs b/src/Core/DAL/Rambler.Cinema.DAL.Entities/Phone.cs index f3e3af5..e31d927 100644 --- a/src/Core/DAL/Rambler.Cinema.DAL.Entities/Phone.cs +++ b/src/Core/DAL/Rambler.Cinema.DAL.Entities/Phone.cs @@ -29,13 +29,18 @@ public class Phone: BaseEntity string DebuggerDisplay => $"{Number} is {PhoneType}"; - - public virtual int? PersonId { get; set; } - [ForeignKey("PersonId")] - public virtual ContactPerson Person { get; set; } - - public virtual int? CinemaId { get; set; } - [ForeignKey("CinemaId")] - public virtual Cinema Cinema { get; set; } + ICollection _сontactPersons; + public virtual ICollection ContactPersons + { + get { return _сontactPersons ?? (_сontactPersons = new List()); } + set { _сontactPersons = value; } + } + + ICollection _cinemas; + public virtual ICollection Cinemas + { + get { return _cinemas ?? (_cinemas = new List()); } + set { _cinemas = value; } + } } } diff --git a/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/CinemaDbContext.cs b/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/CinemaDbContext.cs index 70a113c..4f67c30 100644 --- a/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/CinemaDbContext.cs +++ b/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/CinemaDbContext.cs @@ -39,6 +39,7 @@ public CinemaDbContext(DbConnection dbConnection) public virtual DbSet
Addresses { get; set; } public virtual DbSet Departments { get; set; } public virtual DbSet Persons { get; set; } + public virtual DbSet ContactPersons { get; set; } public virtual DbSet Phones { get; set; } public virtual DbSet Genres { get; set; } @@ -91,6 +92,26 @@ protected override void OnModelCreating(DbModelBuilder modelBuilder) cs.ToTable("Cinema_ContactPerson"); }); + modelBuilder.Entity() + .HasMany(s => s.Phones) + .WithMany(c => c.Cinemas) + .Map(cs => + { + cs.MapLeftKey("CinemaId"); + cs.MapRightKey("PhoneId"); + cs.ToTable("Cinema_Phone"); + }); + + modelBuilder.Entity() + .HasMany(s => s.Phones) + .WithMany(c => c.ContactPersons) + .Map(cs => + { + cs.MapLeftKey("PersonId"); + cs.MapRightKey("PhoneId"); + cs.ToTable("Person_Phone"); + }); + //turn off cascading del. on supervisor person modelBuilder.Entity() .HasRequired(e => e.Supervisor) @@ -99,21 +120,21 @@ protected override void OnModelCreating(DbModelBuilder modelBuilder) .WillCascadeOnDelete(false); - modelBuilder.Entity() + /*modelBuilder.Entity() .HasMany(e => e.Phones) - .WithOptional(e=>e.Person) - .WillCascadeOnDelete(true); + .WithOptional(e=>e.ContactPerson) + .WillCascadeOnDelete(false); modelBuilder.Entity() .HasMany(e => e.Phones) .WithOptional(e => e.Cinema) - .WillCascadeOnDelete(true); + .WillCascadeOnDelete(false);*/ /*modelBuilder.Entity() - .HasMany(s => s.Person) - .WithOptional(c => c.Phones) - .WillCascadeOnDelete();*/ + .HasRequired(s => s.ContactPerson) + .WithOptional(c => c.) + .WillCascadeOnDelete(true);*/ @@ -132,6 +153,7 @@ void RegisterRemovers() { f.FilmSessions.RegisterDeleteOnRemove(this); f.Phones.RegisterDeleteOnRemove(this); + //f.Contacts.RegisterDeleteOnRemove(this); }); this.RegisterForDelete(f => diff --git a/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/EntityDbContextBase.cs b/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/EntityDbContextBase.cs index 2d214e6..a584588 100644 --- a/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/EntityDbContextBase.cs +++ b/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/EntityDbContextBase.cs @@ -83,7 +83,7 @@ DbEntityValidationException ExtractErrorsUp(DbEntityValidationException ex) void AssignDates() { - var entities = ChangeTracker.Entries().Where(x => x.Entity is BaseEntity && (x.State == EntityState.Added || x.State == EntityState.Modified)); + var entities = ChangeTracker.Entries().Where(x => x.Entity is BaseEntity && (x.State == EntityState.Added || x.State == EntityState.Modified)).ToArray(); foreach (var entity in entities) { diff --git a/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/201603090028000_InitialCreate.resx b/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/201603090028000_InitialCreate.resx deleted file mode 100644 index fae9b92..0000000 --- a/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/201603090028000_InitialCreate.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - H4sIAAAAAAAEAO0da2/cuPF7gf4HYT+1hc9rO2lxNew7OOv4zrg4DrLx9fHFkFf0RjittKeHz0bRX9YP/Un9CyX15PslSqsEiwCBVySHQ3JmOBwOZ/73n/+eff+8ibwnkGZhEp/Pjg+PZh6IV0kQxuvzWZE/fvPt7Pvvfv+7s7fB5tn7uan3CtWDLePsfPY5z7en83m2+gw2fna4CVdpkiWP+eEq2cz9IJmfHB39dX58PAcQxAzC8ryzj0WchxtQ/oA/F0m8Atu88KObJABRVn+HJcsSqvfe34Bs66/A+eyjv3mIQHq4CGNYcvg2zq9SWPpbkv5y+WbmXUShD5Faguhx5vlxnOR+DlE+vcvAMk+TeL3cwg9+9OllC2C9Rz/KQD2U06667qiOTtCo5l3DBtSqyPJkYwjw+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9dKENxMDUS8EOe1nl6G/Tv1NVsPo2sOfkIaDzfN3/wceVyC+R8YAAA== - - - dbo - - \ No newline at end of file diff --git a/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/201603090028000_InitialCreate.Designer.cs b/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/201603091238120_InitialCreate.Designer.cs similarity index 92% rename from src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/201603090028000_InitialCreate.Designer.cs rename to src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/201603091238120_InitialCreate.Designer.cs index c90608e..2c25f6d 100644 --- a/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/201603090028000_InitialCreate.Designer.cs +++ b/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/201603091238120_InitialCreate.Designer.cs @@ -13,7 +13,7 @@ public sealed partial class InitialCreate : IMigrationMetadata string IMigrationMetadata.Id { - get { return "201603090028000_InitialCreate"; } + get { return "201603091238120_InitialCreate"; } } string IMigrationMetadata.Source diff --git a/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/201603091238120_InitialCreate.resx b/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/201603091238120_InitialCreate.resx new file mode 100644 index 0000000..8221aa9 --- /dev/null +++ b/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/201603091238120_InitialCreate.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 + + + H4sIAAAAAAAEAO1d227cOBJ9X2D/QejHRcZtO9nFrGHPwGnHM8bEsZGOs5cXQ27RHWHUUo8uHhuL/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lk7NyjukhnawdHFeskgTSF73xzcwRcxCu+tfl2ALFx3JE4hzRisiL17W+YqfkwaRwLFUVOEjjAHuR/Ajf15moePyASkyQpBNV7PvM9+VMAi7zYPILiKb4p8W+Swy2DzEBFrauSKkLVf5mIkeT692aJfmYsuQDZDFBF9E78twiho+b7khNQKSCAfRx3+jeYyR2Hg65eW0gcG4CJC9fC1rplPYLONILHsJl76T8CGt7sMvAdrf/XSXBsoJqKeCHLYTy9Cf536m6ym0dWHPyGGg83zD/8H0q43UabNAAA= + + + dbo + + \ No newline at end of file diff --git a/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/201603091412280_InitialCreate.Designer.cs b/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/201603091412280_InitialCreate.Designer.cs new file mode 100644 index 0000000..a2677aa --- /dev/null +++ b/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/201603091412280_InitialCreate.Designer.cs @@ -0,0 +1,29 @@ +// +namespace Rambler.Cinema.EntFrameworkDB.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 InitialCreate : IMigrationMetadata + { + private readonly ResourceManager Resources = new ResourceManager(typeof(InitialCreate)); + + string IMigrationMetadata.Id + { + get { return "201603091412280_InitialCreate"; } + } + + string IMigrationMetadata.Source + { + get { return null; } + } + + string IMigrationMetadata.Target + { + get { return Resources.GetString("Target"); } + } + } +} diff --git a/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/201603090028000_InitialCreate.cs b/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/201603091412280_InitialCreate.cs similarity index 87% rename from src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/201603090028000_InitialCreate.cs rename to src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/201603091412280_InitialCreate.cs index e1e68a8..585f741 100644 --- a/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/201603090028000_InitialCreate.cs +++ b/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/201603091412280_InitialCreate.cs @@ -98,18 +98,12 @@ public override void Up() PhoneId = c.Int(nullable: false, identity: true), Number = c.String(nullable: false, maxLength: 32, unicode: false), PhoneType = c.Int(), - PersonId = c.Int(), - CinemaId = c.Int(), TimeStamp = c.Binary(nullable: false, fixedLength: true, timestamp: true, storeType: "rowversion"), DateCreated = c.DateTime(nullable: false), DateUpdated = c.DateTime(nullable: false), }) .PrimaryKey(t => t.PhoneId) - .ForeignKey("dbo.Person", t => t.PersonId, cascadeDelete: true) - .ForeignKey("dbo.Cinema", t => t.CinemaId, cascadeDelete: true) - .Index(t => t.Number, name: "UX_Phone_Number") - .Index(t => t.PersonId) - .Index(t => t.CinemaId); + .Index(t => t.Number, name: "UX_Phone_Number"); CreateTable( "dbo.Session", @@ -160,6 +154,19 @@ public override void Up() .PrimaryKey(t => t.GenreId) .Index(t => t.Name, unique: true, name: "UX_Genre_Name"); + CreateTable( + "dbo.Person_Phone", + c => new + { + PersonId = c.Int(nullable: false), + PhoneId = c.Int(nullable: false), + }) + .PrimaryKey(t => new { t.PersonId, t.PhoneId }) + .ForeignKey("dbo.Person", t => t.PersonId, cascadeDelete: true) + .ForeignKey("dbo.Phone", t => t.PhoneId, cascadeDelete: true) + .Index(t => t.PersonId) + .Index(t => t.PhoneId); + CreateTable( "dbo.Cinema_ContactPerson", c => new @@ -173,24 +180,43 @@ public override void Up() .Index(t => t.CinemaId) .Index(t => t.PersonId); + CreateTable( + "dbo.Cinema_Phone", + c => new + { + CinemaId = c.Int(nullable: false), + PhoneId = c.Int(nullable: false), + }) + .PrimaryKey(t => new { t.CinemaId, t.PhoneId }) + .ForeignKey("dbo.Cinema", t => t.CinemaId, cascadeDelete: true) + .ForeignKey("dbo.Phone", t => t.PhoneId, cascadeDelete: true) + .Index(t => t.CinemaId) + .Index(t => t.PhoneId); + } public override void Down() { DropForeignKey("dbo.Cinema", "SupervisorId", "dbo.Person"); - DropForeignKey("dbo.Phone", "CinemaId", "dbo.Cinema"); + DropForeignKey("dbo.Cinema_Phone", "PhoneId", "dbo.Phone"); + DropForeignKey("dbo.Cinema_Phone", "CinemaId", "dbo.Cinema"); DropForeignKey("dbo.Session", "FilmId", "dbo.Film"); DropForeignKey("dbo.Film", "ProducerId", "dbo.Person"); DropForeignKey("dbo.Film", "GenreId", "dbo.Genre"); DropForeignKey("dbo.Session", "CinemaId", "dbo.Cinema"); DropForeignKey("dbo.Cinema_ContactPerson", "PersonId", "dbo.Person"); DropForeignKey("dbo.Cinema_ContactPerson", "CinemaId", "dbo.Cinema"); - DropForeignKey("dbo.Phone", "PersonId", "dbo.Person"); + DropForeignKey("dbo.Person_Phone", "PhoneId", "dbo.Phone"); + DropForeignKey("dbo.Person_Phone", "PersonId", "dbo.Person"); DropForeignKey("dbo.Person", "DepartmentId", "dbo.Department"); DropForeignKey("dbo.Cinema", "AddressId", "dbo.Address"); DropForeignKey("dbo.Address", "CityId", "dbo.City"); + DropIndex("dbo.Cinema_Phone", new[] { "PhoneId" }); + DropIndex("dbo.Cinema_Phone", new[] { "CinemaId" }); DropIndex("dbo.Cinema_ContactPerson", new[] { "PersonId" }); DropIndex("dbo.Cinema_ContactPerson", new[] { "CinemaId" }); + DropIndex("dbo.Person_Phone", new[] { "PhoneId" }); + DropIndex("dbo.Person_Phone", new[] { "PersonId" }); DropIndex("dbo.Genre", "UX_Genre_Name"); DropIndex("dbo.Film", new[] { "GenreId" }); DropIndex("dbo.Film", new[] { "ProducerId" }); @@ -198,8 +224,6 @@ public override void Down() DropIndex("dbo.Film", "IX_Film_Name"); DropIndex("dbo.Session", new[] { "CinemaId" }); DropIndex("dbo.Session", new[] { "FilmId" }); - DropIndex("dbo.Phone", new[] { "CinemaId" }); - DropIndex("dbo.Phone", new[] { "PersonId" }); DropIndex("dbo.Phone", "UX_Phone_Number"); DropIndex("dbo.Department", "UX_Department_Name"); DropIndex("dbo.Person", new[] { "DepartmentId" }); @@ -210,7 +234,9 @@ public override void Down() DropIndex("dbo.City", "UX_City_Name"); DropIndex("dbo.Address", "IX_Address_ZipCode"); DropIndex("dbo.Address", new[] { "CityId" }); + DropTable("dbo.Cinema_Phone"); DropTable("dbo.Cinema_ContactPerson"); + DropTable("dbo.Person_Phone"); DropTable("dbo.Genre"); DropTable("dbo.Film"); DropTable("dbo.Session"); diff --git a/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/201603091412280_InitialCreate.resx b/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/201603091412280_InitialCreate.resx new file mode 100644 index 0000000..bbb8f61 --- /dev/null +++ b/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/201603091412280_InitialCreate.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 + + + H4sIAAAAAAAEAO1dW2/cuBV+L9D/IMxTW2Q9tpMWW8PeRTKOd42NYyMTby8vhjyiJ8JqpFldvDaK/rI+9Cf1L5TUlfebKI0cDAIEHl4OD8nvHJKHRzz/+89/T79/2kTeI0izMInPZkcHhzMPxKskCOP12azIH775dvb9d7//3en7YPPk/dyUe43KwZpxdjb7kufbk/k8W30BGz872ISrNMmSh/xglWzmfpDMjw8P/zo/OpoDSGIGaXne6acizsMNKH/An4skXoFtXvjRVRKAKKvTYc6ypOp99Dcg2/orcDb75G/uI5AeLMIY5hy8j/OLFOb+lqS/nL+beW+j0IdMLUH0MPP8OE5yP4csn9xmYJmnSbxebmGCH31+3gJY7sGPMlB35aQrrturw2PUq3lXs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W+LHHYZbO4j4qSFrGKy9suY2iTPp9db9Ctz0QXIZoi+B7yO3xVhFLR8X3C+cBGQQOa2+uNHNJc5+ghy/dxS+sgAXESoHr7WSvgZbLYRJJZdx0v/EdjwdpuBD2Dtr56bp3XFRNQTQQ776Xnor1N/k9U0uvrwJ8RwsHn67v8l0MHcqdAAAA== + + + dbo + + \ No newline at end of file diff --git a/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/Configuration.cs b/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/Configuration.cs index 0d401b4..28e0609 100644 --- a/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/Configuration.cs +++ b/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Migrations/Configuration.cs @@ -1,3 +1,4 @@ +using System.Collections.Concurrent; using System.Collections.Generic; using System.Data.Entity.ModelConfiguration.Conventions; using System.Linq.Expressions; @@ -67,7 +68,7 @@ protected override void Seed(Rambler.Cinema.EntFrameworkDB.CinemaDbContext conte .Fill(c => c.Number).AsPhoneNumber() .Fill(c => c.PhoneType).WithRandom(new PhoneType?[]{PhoneType.Work, PhoneType.Home, PhoneType.Cell, PhoneType.Main, PhoneType.Additional}); - var phonesPull = A.ListOf(500).DistinctBy(c => c.Number).ToList(); + //var phonesPull = A.ListOf(500).DistinctBy(c => c.Number).ToList(); //context.Phones.AddRange(phonesPull); @@ -90,7 +91,7 @@ protected override void Seed(Rambler.Cinema.EntFrameworkDB.CinemaDbContext conte "Usher", "Cleaning woman" }) .Fill(c => c.Department, (c) => DepByTitle(c.Title, deps)) - .Fill(c => c.Phones, GetItems(phonesPull, rnd.Next(1, 4), context)); + .Fill(c => c.Phones, GetPhones(rnd.Next(1, 4))); var persons = A.ListOf(100).ToList(); var cpersons = A.ListOf(100).ToList(); @@ -196,32 +197,34 @@ protected override void Seed(Rambler.Cinema.EntFrameworkDB.CinemaDbContext conte .Fill(c => c.Name, (c) => fnames[cinemaIt.Next()]) .Fill(c => c.HallsNumber).WithRandom(new[] {1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 6}) .Fill(c => c.Address, () => A.New
()) - .Fill(c => c.Phones, (c) => GetItems(phonesPull, rnd.Next(1, 6), context)) + .Fill(c => c.Phones, (c) => GetPhones(rnd.Next(1, 6))) .Fill(c => c.Supervisor).WithRandom(persons) - .Fill(c => c.Contacts, (c) => GetItems(cpersons, 8, context)); + .Fill(c => c.Contacts, (c) => GetItems(cpersons, rnd.Next(1, 8), context)); var cinemas = A.ListOf(fnames.Length).ToList(); context.Cinemas.AddRange(cinemas); - context.SaveChanges(); - } - - - static Random _rnd = new Random(); - static ICollection GetRandom(IList p, int countMax) - { - int cnt = _rnd.Next(1, countMax); - var res = new List(cnt); - for (int i = 0; i < cnt; ++i) - res.Add(p[_rnd.Next(0, p.Count)]); + context.SaveChanges(); - return res.Distinct().ToList(); + /*foreach (var cinema in cinemas) + { + var cnt = rnd.Next(1, 8); + while (cnt-- > 0) + cinema.Contacts.Add(A.New()); + } + context.SaveChanges();*/ } + + static ICollection GetPhones(int count) + { + return new HashSet(A.ListOf(count).ToArray()); + } + static ICollection GetItems(IList pull, int cnt, DbContext ctx) where T:class { - var res = new List(cnt); + var res = new HashSet(); for (int i = Math.Min(cnt, pull.Count); i > 0; --i) { var latsIdx = pull.Count - 1; @@ -252,6 +255,7 @@ static Department DepByTitle(string title, IList deps) return deps.First(d => d.Name == _depsMap[title]); } + static readonly Random _rnd = new Random(); static string GetZip(Address a) { return _rnd.Next(100000, 200000).ToString(); diff --git a/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Rambler.Cinema.EntFrameworkDB.csproj b/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Rambler.Cinema.EntFrameworkDB.csproj index 5da1633..1bd24f0 100644 --- a/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Rambler.Cinema.EntFrameworkDB.csproj +++ b/src/Core/DAL/Rambler.Cinema.EntFrameworkDB/Rambler.Cinema.EntFrameworkDB.csproj @@ -59,9 +59,9 @@ - - - 201603090028000_InitialCreate.cs + + + 201603091412280_InitialCreate.cs @@ -80,8 +80,8 @@ - - 201603090028000_InitialCreate.cs + + 201603091412280_InitialCreate.cs diff --git a/src/Hosts/Rambler.Cinema.IisHost/Web.config b/src/Hosts/Rambler.Cinema.IisHost/Web.config index a6d5436..22e1fb0 100644 --- a/src/Hosts/Rambler.Cinema.IisHost/Web.config +++ b/src/Hosts/Rambler.Cinema.IisHost/Web.config @@ -22,8 +22,9 @@ - - + + +