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,49 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
namespace System.Data.Entity.Infrastructure
{
using System.Data.Entity.Core.Metadata.Edm;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Data.Entity.Utilities;
using System.Linq;
/// <summary>
/// This <see cref="DbModelBuilder" /> convention uses the name of the derived
/// <see cref="DbContext" /> class as the container for the conceptual model built by
/// Code First.
/// </summary>
public class ModelContainerConvention : IEdmConvention
{
#region Fields and constructors
private readonly string _containerName;
/// <summary>
/// Initializes a new instance of the <see cref="ModelContainerConvention" /> class.
/// </summary>
/// <param name="containerName"> The model container name. </param>
internal ModelContainerConvention(string containerName)
{
DebugCheck.NotEmpty(containerName);
_containerName = containerName;
}
#endregion
#region Convention Apply
/// <summary>
/// Applies the convention to the given model.
/// </summary>
/// <param name="model"> The model. </param>
public virtual void Apply(EdmModel model)
{
Check.NotNull(model, "model");
model.Containers.Single().Name = _containerName;
}
#endregion
}
}