Files
dotnet-bot adf899c629 Adding System.Data..., System.ServiceModel..., and System.Web...
Adding reference source for
System.Data
System.Data.DataSetExtensions
System.Data.Entity
System.Data.Entity.Design
System.Data.Linq
System.Data.SqlXml
System.ServiceModel
System.ServiceModel.Activation
System.ServiceModel.Activities
System.ServiceModel.Channels
System.ServiceModel.Discovery
System.ServiceModel.Internals
System.ServiceModel.Routing
System.ServiceModel.WasHosting
System.ServiceModel.Web
System.Web
System.Web.ApplicationServices
System.Web.DynamicData
System.Web.Entity
System.Web.Entity.Design
System.Web.Extensions
System.Web.Mobile
System.Web.Routing
System.Web.Services
System.Xml
System.Xml.Linq
2016-05-03 00:07:37 +02:00

56 lines
1.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
namespace System.Data.Linq.SqlClient {
/// <summary>
/// Associate annotations with SqlNodes.
/// </summary>
internal class SqlNodeAnnotations {
Dictionary<SqlNode, List<SqlNodeAnnotation>> annotationMap = new Dictionary<SqlNode, List<SqlNodeAnnotation>>();
Dictionary<Type, string> uniqueTypes = new Dictionary<Type, string>();
/// <summary>
/// Add an annotation to the given node.
/// </summary>
internal void Add(SqlNode node, SqlNodeAnnotation annotation) {
List<SqlNodeAnnotation> list = null;
if (!this.annotationMap.TryGetValue(node, out list)) {
list = new List<SqlNodeAnnotation>();
this.annotationMap[node]=list;
}
uniqueTypes[annotation.GetType()] = String.Empty;
list.Add(annotation);
}
/// <summary>
/// Gets the annotations for the given node. Null if none.
/// </summary>
internal List<SqlNodeAnnotation> Get(SqlNode node) {
List<SqlNodeAnnotation> list = null;
this.annotationMap.TryGetValue(node, out list);
return list;
}
/// <summary>
/// Whether the given node has annotations.
/// </summary>
internal bool NodeIsAnnotated(SqlNode node) {
if (node == null)
return false;
return this.annotationMap.ContainsKey(node);
}
/// <summary>
/// Checks whether there's at least one annotation of the given type.
/// </summary>
internal bool HasAnnotationType(Type type) {
return this.uniqueTypes.ContainsKey(type);
}
}
}