Updates referencesource to .NET 4.7
[mono-project.git] / mcs / class / referencesource / System.Web.Entity.Design / System / Data / WebControls / Design / EntityDataSourceContainerNameItem.cs
blob1a470ab01c4d6eef65b0d5ed7236f592b6c1fab2
1 //------------------------------------------------------------------------------
2 // <copyright file="EntityDataSourceContainerNameItem.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
4 // </copyright>
5 //
6 // @owner Microsoft
7 // @backupOwner Microsoft
8 //------------------------------------------------------------------------------
10 using System.Data.Metadata.Edm;
11 using System.Diagnostics;
13 namespace System.Web.UI.Design.WebControls
15 internal class EntityDataSourceContainerNameItem : IComparable<EntityDataSourceContainerNameItem>
17 // Only one of the following should be set. This is enforced through the constructors and the fact that these fields are readonly.
18 private readonly EntityContainer _entityContainer; // used when we have a real EntityContainer backing this item
19 private readonly string _unknownContainerName; // used when we have an unknown DefaultContainerName that we still want to include in the list
21 internal EntityDataSourceContainerNameItem(EntityContainer entityContainer)
23 Debug.Assert(entityContainer != null, "null entityContainer");
24 _entityContainer = entityContainer;
27 internal EntityDataSourceContainerNameItem(string unknownContainerName)
29 Debug.Assert(!String.IsNullOrEmpty(unknownContainerName), "null or empty unknownContainerName");
30 _unknownContainerName = unknownContainerName;
33 internal string EntityContainerName
35 get
37 if (_entityContainer != null)
39 return _entityContainer.Name;
41 else
43 return _unknownContainerName;
48 internal EntityContainer EntityContainer
50 get
52 // may be null if this represents an unknown container
53 return _entityContainer;
57 public override string ToString()
59 return this.EntityContainerName;
62 int IComparable<EntityDataSourceContainerNameItem>.CompareTo(EntityDataSourceContainerNameItem other)
64 return (String.Compare(this.EntityContainerName, other.EntityContainerName, StringComparison.OrdinalIgnoreCase));