Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
namespace BadMappingModel
{
public class Office
{
public int OfficeId { get; set; }
public string Name { get; set; }
}
public class Employee
{
public int EmployeeId { get; set; }
public string Name { get; set; }
public string Name2 { get; set; }
}
public class OnSiteEmployee : Employee
{
public Office Office { get; set; }
}
public class OffSiteEmployee : Employee
{
public string SiteName { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
namespace SimpleModel
{
using System.Data.Entity;
public class CeLoginsContext : LoginsContext
{
public CeLoginsContext()
{
Database.SetInitializer(new DropCreateDatabaseIfModelChanges<CeLoginsContext>());
}
}
}

View File

@@ -0,0 +1,22 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
namespace SimpleModel
{
using System.Data.Entity;
public class DisabledByConfigInitializerContext : DbContext
{
}
public class DisabledByConfigWithInitializerAlsoSetInConfigContext : DbContext
{
}
public class DisabledByLegacyConfigInitializerContext : DbContext
{
}
public class DisabledByLegacyConfigWithEmptyInitializerContext : DbContext
{
}
}

View File

@@ -0,0 +1,10 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
namespace SimpleModel
{
using System.Data.Entity;
public class EntityConnectionForSimpleModel : DbContext
{
}
}

View File

@@ -0,0 +1,11 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
namespace SimpleModel
{
using System.Data.Entity;
public class LocalDbLoginsContext : DbContext
{
public DbSet<Login> Logins { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
namespace SimpleModel
{
using System.Data.Entity;
public class LoginsContext : DbContext
{
public DbSet<Login> Logins { get; set; }
}
}

View File

@@ -0,0 +1,56 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
namespace ProductivityApiTests
{
using System.ComponentModel.DataAnnotations;
using System.Data.Entity;
public class ModelWithWideProperties : DbContext
{
public ModelWithWideProperties()
{
Database.SetInitializer(new DropCreateDatabaseIfModelChanges<ModelWithWideProperties>());
}
public DbSet<EntityWithExplicitWideProperties> ExplicitlyWide { get; set; }
public DbSet<EntityWithImplicitWideProperties> ImplicitlyWide { get; set; }
}
public class ModelWithWidePropertiesForSqlCe : DbContext
{
public ModelWithWidePropertiesForSqlCe()
{
Database.SetInitializer(new DropCreateDatabaseIfModelChanges<ModelWithWidePropertiesForSqlCe>());
}
public DbSet<EntityWithExplicitWideProperties> ExplicitlyWide { get; set; }
public DbSet<EntityWithImplicitWideProperties> ImplicitlyWide { get; set; }
}
public class EntityWithExplicitWideProperties
{
public int Id { get; set; }
[MaxLength(4000)]
public string Property1 { get; set; }
[MaxLength(4000)]
public string Property2 { get; set; }
[MaxLength(4000)]
public string Property3 { get; set; }
[MaxLength(4000)]
public string Property4 { get; set; }
}
public class EntityWithImplicitWideProperties
{
public int Id { get; set; }
public string Property1 { get; set; }
public string Property2 { get; set; }
public string Property3 { get; set; }
public string Property4 { get; set; }
}
}

View File

@@ -0,0 +1,60 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
namespace SimpleModel
{
using System.Data.Common;
using System.Data.Entity;
using System.Data.Entity.Core.Objects;
using System.Data.Entity.Infrastructure;
[DbModelBuilderVersion(DbModelBuilderVersion.Latest)]
public class SimpleLocalDbModelContext : DbContext
{
public SimpleLocalDbModelContext()
{
}
public SimpleLocalDbModelContext(DbCompiledModel model)
: base(model)
{
}
public SimpleLocalDbModelContext(string nameOrConnectionString)
: base(nameOrConnectionString)
{
}
public SimpleLocalDbModelContext(string nameOrConnectionString, DbCompiledModel model)
: base(nameOrConnectionString, model)
{
}
public SimpleLocalDbModelContext(DbConnection existingConnection, bool contextOwnsConnection = false)
: base(existingConnection, contextOwnsConnection)
{
}
public SimpleLocalDbModelContext(DbConnection existingConnection, DbCompiledModel model, bool contextOwnsConnection = false)
: base(existingConnection, model, contextOwnsConnection)
{
}
public SimpleLocalDbModelContext(ObjectContext objectContext, bool dbContextOwnsObjectContext = false)
: base(objectContext, dbContextOwnsObjectContext)
{
}
public DbSet<Product> Products { get; set; }
public DbSet<Category> Categories { get; set; }
public static DbModelBuilder CreateBuilder()
{
var builder = new DbModelBuilder();
builder.Entity<Product>();
builder.Entity<Category>();
return builder;
}
}
}

View File

@@ -0,0 +1,63 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
namespace SimpleModel
{
using System.Data.Common;
using System.Data.Entity;
using System.Data.Entity.Core.Objects;
using System.Data.Entity.Infrastructure;
public class SimpleLocalDbModelContextWithNoData : DbContext
{
static SimpleLocalDbModelContextWithNoData()
{
Database.SetInitializer(new DropCreateDatabaseAlways<SimpleModelContextWithNoData>());
}
public SimpleLocalDbModelContextWithNoData()
{
}
public SimpleLocalDbModelContextWithNoData(string nameOrConnectionString)
: base(nameOrConnectionString)
{
}
public SimpleLocalDbModelContextWithNoData(DbCompiledModel model)
: base(model)
{
}
public SimpleLocalDbModelContextWithNoData(string nameOrConnectionString, DbCompiledModel model)
: base(nameOrConnectionString, model)
{
}
public SimpleLocalDbModelContextWithNoData(DbConnection existingConnection, bool contextOwnsConnection = false)
: base(existingConnection, contextOwnsConnection)
{
}
public SimpleLocalDbModelContextWithNoData(
DbConnection existingConnection, DbCompiledModel model, bool contextOwnsConnection = false)
: base(existingConnection, model, contextOwnsConnection)
{
}
public SimpleLocalDbModelContextWithNoData(ObjectContext objectContext, bool dbContextOwnsObjectContext = false)
: base(objectContext, dbContextOwnsObjectContext)
{
}
public IDbSet<Product> Products { get; set; }
public IDbSet<Category> Categories { get; set; }
public bool SaveChangesCalled { get; set; }
public override int SaveChanges()
{
SaveChangesCalled = true;
return base.SaveChanges();
}
}
}

View File

@@ -0,0 +1,73 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
namespace SimpleModel
{
using System.Collections.Generic;
using System.Data.Entity;
public class SimpleLocalDbModelInitializer : DropCreateDatabaseAlways<SimpleLocalDbModelContext>
{
protected override void Seed(SimpleLocalDbModelContext context)
{
new List<Product>
{
new Product
{
Name = "Marmite",
CategoryId = "Foods"
},
new Product
{
Name = "Bovril",
CategoryId = "Beverages"
},
new Product
{
Name = "iSnack 2.0",
CategoryId = "Foods"
},
new Product
{
Name = "Irn-Bru",
CategoryId = "Beverages"
},
new Product
{
Name = "Ibuprofen",
CategoryId = "Medications"
},
new Product
{
Name = "Strongbow",
CategoryId = "Medications"
},
new FeaturedProduct
{
Name = "Cadillac",
CategoryId = "Cars",
PromotionalCode = "Ed Wood"
},
}.ForEach(p => context.Products.Add(p));
new List<Category>
{
new Category
{
Id = "Beverages"
},
new Category
{
Id = "Foods"
},
new Category
{
Id = "Medications"
},
new Category
{
Id = "Cars"
},
}.ForEach(c => context.Categories.Add(c));
}
}
}