本文整理汇总了C#中IConceptInfo.GetUserDescription方法的典型用法代码示例。如果您正苦于以下问题:C# IConceptInfo.GetUserDescription方法的具体用法?C# IConceptInfo.GetUserDescription怎么用?C# IConceptInfo.GetUserDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IConceptInfo
的用法示例。
在下文中一共展示了IConceptInfo.GetUserDescription方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidatePropertyListSyntax
public static void ValidatePropertyListSyntax(string dslList, IConceptInfo errorContext)
{
var errorHeader = new Lazy<string>(() =>
"Invalid format of list '" + dslList + "' in '" + errorContext.GetUserDescription() + "': ");
if (string.IsNullOrWhiteSpace(dslList))
throw new DslSyntaxException(errorHeader.Value + "The list is empty.");
if (dslList.Contains(',') || dslList.Contains(';'))
throw new DslSyntaxException(errorHeader.Value + "Property names in the list must be separated with spaces.");
if (dslList.Contains('.'))
throw new DslSyntaxException(errorHeader.Value + "The list must contain only property names, without data structure or entity names (or dot character).");
// Ensure uniqueness of the concept's key. There should not exists different instances of SqlIndexMultiple that generate same index in database.
if (dslList.Contains(" "))
throw new DslSyntaxException(errorHeader.Value + "Property names in the list must be separated by single space character. Verify that there are no multiple spaces.");
if (dslList.StartsWith(" "))
throw new DslSyntaxException(errorHeader.Value + "The list of property names must not start with a space character.");
if (dslList.EndsWith(" "))
throw new DslSyntaxException(errorHeader.Value + "The list of property names must not end with a space character.");
}
示例2: GetDependsOnWriteableDataStructure
private static void GetDependsOnWriteableDataStructure(DataStructureInfo dataStructure, List<DataStructureInfo> dependencies, IEnumerable<IConceptInfo> allConcepts, IConceptInfo errorContext, HashSet<string> done)
{
var conceptKey = dataStructure.GetKey();
if (done.Contains(conceptKey))
return;
done.Add(conceptKey);
if (dataStructure is EntityInfo)
dependencies.Add(dataStructure);
else if (dataStructure is SqlQueryableInfo)
{
var deps = allConcepts.OfType<SqlDependsOnDataStructureInfo>().Where(dep => dep.Dependent == dataStructure).ToArray();
foreach (var dep in deps)
GetDependsOnWriteableDataStructure(dep.DependsOn, dependencies, allConcepts, errorContext, done);
}
else
throw new DslSyntaxException(errorContext.GetKeywordOrTypeName()
+ " is not supported on dependency type '" + dataStructure.GetKeywordOrTypeName() + "'. "
+ errorContext.GetUserDescription() + " depends on " + dataStructure.GetUserDescription() + ".");
}
示例3: DslSyntaxException
public DslSyntaxException(IConceptInfo concept, string additionalMessage, Exception inner)
: base(concept.GetUserDescription() + ": " + additionalMessage, inner)
{
}
示例4: AddReferencesBeforeConcept
private static void AddReferencesBeforeConcept(IConceptInfo concept, List<IConceptInfo> sortedList, Dictionary<IConceptInfo, bool> processed)
{
if (!processed.ContainsKey(concept))
throw new FrameworkException(string.Format(
"Unexpected inner state: Referenced concept {0} is not found in list of all concepts.",
concept.GetUserDescription()));
if (processed[concept]) // eliminates duplication of referenced concepts and stops circular references from infinite recursion
return;
processed[concept] = true;
foreach (ConceptMember member in ConceptMembers.Get(concept))
if (member.IsConceptInfo)
AddReferencesBeforeConcept((IConceptInfo)member.GetValue(concept), sortedList, processed);
sortedList.Add(concept);
}
示例5: ReportErrorContext
protected string ReportErrorContext(IConceptInfo conceptInfo, int index)
{
var sb = new StringBuilder();
sb.AppendLine(_dslSource.ReportError(index));
if (conceptInfo != null)
{
sb.AppendFormat("Previous concept: {0}", conceptInfo.GetUserDescription()).AppendLine();
var properties = conceptInfo.GetType().GetProperties().ToList();
properties.ForEach(it =>
sb.AppendFormat("Property {0} ({1}) = {2}",
it.Name,
it.PropertyType.Name,
it.GetValue(conceptInfo, null) ?? "<null>")
.AppendLine());
}
return sb.ToString();
}
示例6: CreateNewConcepts
internal static IList<IConceptInfo> CreateNewConcepts(
BrowseDataStructureInfo browse, string path, string newPropertyName,
IEnumerable<IConceptInfo> existingConcepts, IConceptInfo errorContext)
{
var newConcepts = new List<IConceptInfo>();
ValueOrError<PropertyInfo> sourceProperty = GetSelectedPropertyByPath(browse, path, existingConcepts);
if (sourceProperty.IsError)
return null; // Creating the browse property may be delayed for other macro concepts to generate the needed properties. If this condition is not resolved, the CheckSemantics function below will throw an exception.
if (!IsValidIdentifier(newPropertyName))
throw new DslSyntaxException(string.Format(
"Invalid format of {0}: Property name '{1}' is not a valid identifier. Specify a valid name before the path to override the generated name.",
errorContext.GetUserDescription(),
newPropertyName));
var cloneMethod = typeof(object).GetMethod("MemberwiseClone", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
var browseProperty = (PropertyInfo)cloneMethod.Invoke(sourceProperty.Value, null);
browseProperty.DataStructure = browse;
browseProperty.Name = newPropertyName;
var browsePropertySelector = new BrowseFromPropertyInfo { PropertyInfo = browseProperty, Path = path };
return new IConceptInfo[] { browseProperty, browsePropertySelector };
}
示例7: CheckSemantics
internal static void CheckSemantics(BrowseDataStructureInfo browse, string path, IEnumerable<IConceptInfo> concepts, IConceptInfo errorContext)
{
var property = GetSelectedPropertyByPath(browse, path, concepts);
if (property.IsError)
throw new DslSyntaxException("Invalid format of " + errorContext.GetUserDescription() + ": " + property.Error);
}