/// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary> /// <param name="isNew">是否插入</param> public override void Valid(Boolean isNew) { // 如果没有脏数据,则不需要进行任何处理 if (!HasDirty) { return; } // 这里验证参数范围,建议抛出参数异常,指定参数名,前端用户界面可以捕获参数异常并聚焦到对应的参数输入框 if (Id.IsNullOrEmpty()) { throw new ArgumentNullException(nameof(Id), "Id不能为空!"); } if (ApiResourceName.IsNullOrEmpty()) { throw new ArgumentNullException(nameof(ApiResourceName), "ApiResourceName不能为空!"); } if (NormalizedName.IsNullOrEmpty()) { throw new ArgumentNullException(nameof(NormalizedName), "NormalizedName不能为空!"); } // 在新插入数据或者修改了指定字段时进行修正 // 检查唯一索引 // CheckExist(isNew, __.ApiResourceName); // CheckExist(isNew, __.NormalizedName); }
internal static NormalizedName NameNormalizer(EFElement parent, string refName) { Debug.Assert(parent != null, "parent should not be null"); NormalizedName normalizedName = null; if (refName == null) { return(null); } var modfunc = parent as ModificationFunction; if (modfunc != null) { normalizedName = EFNormalizableItemDefaults.DefaultNameNormalizerForMSL(modfunc, refName); } else { var parentItem = parent; normalizedName = EFNormalizableItemDefaults.DefaultNameNormalizerForEDM(parentItem, refName); } if (normalizedName == null) { var symbol = new Symbol(refName); normalizedName = new NormalizedName(symbol, null, null, refName); } return(normalizedName); }
internal static NormalizedName NameNormalizer(EFElement parent, string refName) { Debug.Assert(parent != null, "parent should not be null"); if (refName == null) { return null; } var pr = parent as PropertyRef; var key = pr.Parent as Key; var entityType = key.Parent as EntityType; var em = entityType.Parent as BaseEntityModel; Symbol symbol = null; if (em != null) { symbol = new Symbol(em.NamespaceValue, entityType.LocalName.Value, refName); } if (symbol == null) { symbol = new Symbol(refName); } var normalizedName = new NormalizedName(symbol, null, null, refName); return normalizedName; }
internal static NormalizedName NameNormalizer(EFElement parent, string refName) { Debug.Assert(parent != null, "parent should not be null"); NormalizedName normalizedName = null; if (refName == null) { return null; } var modfunc = parent as ModificationFunction; if (modfunc != null) { normalizedName = EFNormalizableItemDefaults.DefaultNameNormalizerForMSL(modfunc, refName); } else { var parentItem = parent; normalizedName = EFNormalizableItemDefaults.DefaultNameNormalizerForEDM(parentItem, refName); } if (normalizedName == null) { var symbol = new Symbol(refName); normalizedName = new NormalizedName(symbol, null, null, refName); } return normalizedName; }
internal static NormalizedName NameNormalizer(EFElement parent, string refName) { Debug.Assert(parent != null, "parent should not be null"); NormalizedName normalizedName = null; if (refName == null) { return(null); } var parentEndProperty = parent as EndProperty; if (parentEndProperty != null) { normalizedName = EFNormalizableItemDefaults.DefaultNameNormalizerForMSL(parentEndProperty, refName); } else { var parentItem = parent; normalizedName = EFNormalizableItemDefaults.DefaultNameNormalizerForEDM(parentItem, refName); } if (normalizedName == null) { normalizedName = new NormalizedName(new Symbol(refName), null, null, refName); } return(normalizedName); }
internal static NormalizedName NameNormalizer(EFElement parent, string refName) { Debug.Assert(parent != null, "parent should not be null"); if (refName == null) { return(null); } var pr = parent as PropertyRef; var key = pr.Parent as Key; var entityType = key.Parent as EntityType; var em = entityType.Parent as BaseEntityModel; Symbol symbol = null; if (em != null) { symbol = new Symbol(em.NamespaceValue, entityType.LocalName.Value, refName); } if (symbol == null) { symbol = new Symbol(refName); } var normalizedName = new NormalizedName(symbol, null, null, refName); return(normalizedName); }
internal static NormalizedName NameNormalizer(EFElement parent, string refName) { Debug.Assert(parent != null, "parent should not be null"); if (refName == null) { return(null); } Symbol symbol = null; var fi = parent as FunctionImport; var func = parent as Function; var fsp = parent as FunctionScalarProperty; var modFunc = parent as ModificationFunction; if (fi != null) { // if we are in the CSDL, build it's normalized name based on the EC name // FunctionImports live in the entity container var ec = fi.Parent as BaseEntityContainer; if (ec != null) { symbol = new Symbol(ec.EntityContainerName, fi.LocalName.Value, refName); } } else if (func != null) { // if we are in the SSDL, then build the name based on the namespace // Functions are top level types like EntityType and Association symbol = new Symbol(((BaseEntityModel)func.Parent).NamespaceValue, func.LocalName.Value, refName); } else if (fsp != null) { // this FunctionScalarProperty could be right under the function, nested inside an AssociationEnd, // or N levels deep inside a complex type hierarchy var mod = fsp.GetParentOfType(typeof(ModificationFunction)) as ModificationFunction; Debug.Assert(mod != null, "Failed to get a pointer to the ModificationFunction"); if (mod != null) { // there is a reference to this param in a function mapping, these always // point back to a parameter in a function, i.e., something in the SSDL symbol = GetSymbolBasedOnModificationFunction(parent.Artifact.ArtifactSet, mod, refName); } } else if (null != modFunc) { symbol = GetSymbolBasedOnModificationFunction(parent.Artifact.ArtifactSet, modFunc, refName); } if (symbol == null) { symbol = new Symbol(refName); } var normalizedName = new NormalizedName(symbol, null, null, refName); return(normalizedName); }
private void Init() { var originalNames = _originalName.Split('/'); var normalizedNames = NormalizedName.Split('.'); string currentId = null; string parentId = null; for (var i = 0; i < normalizedNames.Length; i++) { currentId = i == 0 ? normalizedNames[0] : string.Join('.', currentId, normalizedNames[i]); var productCategory = new ProductCategory() { Id = currentId, LocalizationToken = $"categoryName.{currentId}", ParentId = parentId, IsLeaf = i == normalizedNames.Length - 1, }; Nodes.Add(productCategory); if (originalNames.Length == normalizedNames.Length) { _originalNodeNames.Add(currentId, originalNames[i]); } parentId = currentId; } }
internal static NormalizedName NameNormalizer(EFElement parent, string refName) { Debug.Assert(parent != null, "parent should not be null"); NormalizedName normalizedName = null; if (refName == null) { return null; } var parentEndProperty = parent as EndProperty; if (parentEndProperty != null) { normalizedName = EFNormalizableItemDefaults.DefaultNameNormalizerForMSL(parentEndProperty, refName); } else { var parentItem = parent; normalizedName = EFNormalizableItemDefaults.DefaultNameNormalizerForEDM(parentItem, refName); } if (normalizedName == null) { normalizedName = new NormalizedName(new Symbol(refName), null, null, refName); } return normalizedName; }
internal static NormalizedName NameNormalizer(EFElement parent, string refName) { Debug.Assert(parent != null, "parent should not be null"); if (refName == null) { return null; } // cast the parameter to what this really is var end = parent as AssociationSetEnd; Debug.Assert(end != null, "parent should be an AssociationSetEnd"); // get the assoc set var set = end.Parent as AssociationSet; Debug.Assert(set != null, "association set end parent should be an AssociationSet"); // get the entity container name string entityContainerName = null; var ec = set.Parent as BaseEntityContainer; if (ec != null) { entityContainerName = ec.EntityContainerName; } Debug.Assert(ec != null, "AssociationSet parent should be a subclass of BaseEntityContainer"); // the normalized name for an EnitySet is 'EntityContainerName + # + EntitySetName' var symbol = new Symbol(entityContainerName, refName); var normalizedName = new NormalizedName(symbol, null, null, refName); return normalizedName; }
internal static NormalizedName NameNormalizer(EFElement parent, string refName) { Debug.Assert(parent != null, "parent should not be null"); if (refName == null) { return null; } Symbol symbol = null; var fi = parent as FunctionImport; var func = parent as Function; var fsp = parent as FunctionScalarProperty; var modFunc = parent as ModificationFunction; if (fi != null) { // if we are in the CSDL, build it's normalized name based on the EC name // FunctionImports live in the entity container var ec = fi.Parent as BaseEntityContainer; if (ec != null) { symbol = new Symbol(ec.EntityContainerName, fi.LocalName.Value, refName); } } else if (func != null) { // if we are in the SSDL, then build the name based on the namespace // Functions are top level types like EntityType and Association symbol = new Symbol(((BaseEntityModel)func.Parent).NamespaceValue, func.LocalName.Value, refName); } else if (fsp != null) { // this FunctionScalarProperty could be right under the function, nested inside an AssociationEnd, // or N levels deep inside a complex type hierarchy var mod = fsp.GetParentOfType(typeof(ModificationFunction)) as ModificationFunction; Debug.Assert(mod != null, "Failed to get a pointer to the ModificationFunction"); if (mod != null) { // there is a reference to this param in a function mapping, these always // point back to a parameter in a function, i.e., something in the SSDL symbol = GetSymbolBasedOnModificationFunction(parent.Artifact.ArtifactSet, mod, refName); } } else if (null != modFunc) { symbol = GetSymbolBasedOnModificationFunction(parent.Artifact.ArtifactSet, modFunc, refName); } if (symbol == null) { symbol = new Symbol(refName); } var normalizedName = new NormalizedName(symbol, null, null, refName); return normalizedName; }
internal static NormalizedName NameNormalizer(EFElement parent, string refName) { Debug.Assert(parent != null, "parent should not be null"); if (refName == null) { return(null); } var entityContainerName = string.Empty; var parentAssociationSet = parent as AssociationSet; var parentAssociationSetMapping = parent as AssociationSetMapping; var parentFunctionAssociationEnd = parent as FunctionAssociationEnd; if (parentAssociationSet != null) { // are we trying to normalize the name of actual association set in the EC? var ec = parentAssociationSet.Parent as BaseEntityContainer; if (ec != null) { entityContainerName = ec.LocalName.Value; } } else if (parentAssociationSetMapping != null || parentFunctionAssociationEnd != null) { // we need to resolve a reference from the MSL to the AssociationSet var ecm = parent.GetParentOfType(typeof(EntityContainerMapping)) as EntityContainerMapping; if (ecm != null) { entityContainerName = ecm.CdmEntityContainer.RefName; } } Symbol symbol = null; if (!string.IsNullOrEmpty(entityContainerName)) { symbol = new Symbol(entityContainerName, refName); } if (symbol == null) { symbol = new Symbol(refName); } var normalizedName = new NormalizedName(symbol, null, null, refName); return(normalizedName); }
public bool IsMatch(ReadOnlySpan <char> name) { if (NormalizedName.AsReadOnlySpan().AreEqualInvariant(name)) { return(true); } if (NormalizedName.AsReadOnlySpan().AreEqualInvariant(BoltFramework.NormalizeActionName(name))) { return(true); } return(false); }
internal static NormalizedName NameNormalizer(EFElement parent, string refName) { Debug.Assert(parent != null, "parent should not be null"); if (refName == null) { return(null); } NormalizedName normalizedName = null; var parentAssociation = parent as Association; var parentAssociationSet = parent as AssociationSet; var parentAssociationSetMapping = parent as AssociationSetMapping; var parentNavigationProperty = parent as NavigationProperty; if (parentAssociation != null) { var model = parentAssociation.Parent as BaseEntityModel; if (model != null) { // we are coming up with the object's name for the first time var symbol = new Symbol(model.NamespaceValue, parentAssociation.LocalName.Value); normalizedName = new NormalizedName(symbol, null, null, parentAssociation.LocalName.Value); } } else if (parentAssociationSet != null) { // we are wanting to resolve a reference from an Association Set that may or may not // use the alias defined in the EntityModel normalizedName = EFNormalizableItemDefaults.DefaultNameNormalizerForEDM(parentAssociationSet, refName); } else if (parentAssociationSetMapping != null) { normalizedName = EFNormalizableItemDefaults.DefaultNameNormalizerForMSL(parentAssociationSetMapping, refName); } else if (parentNavigationProperty != null) { normalizedName = EFNormalizableItemDefaults.DefaultNameNormalizerForEDM(parentNavigationProperty, refName); } if (normalizedName == null) { var symbol = new Symbol(refName); normalizedName = new NormalizedName(symbol, null, null, refName); } return(normalizedName); }
internal static NormalizedName NameNormalizer(EFElement parent, string refName) { Debug.Assert(parent != null, "parent should not be null"); if (refName == null) { return null; } var entityContainerName = string.Empty; var parentAssociationSet = parent as AssociationSet; var parentAssociationSetMapping = parent as AssociationSetMapping; var parentFunctionAssociationEnd = parent as FunctionAssociationEnd; if (parentAssociationSet != null) { // are we trying to normalize the name of actual association set in the EC? var ec = parentAssociationSet.Parent as BaseEntityContainer; if (ec != null) { entityContainerName = ec.LocalName.Value; } } else if (parentAssociationSetMapping != null || parentFunctionAssociationEnd != null) { // we need to resolve a reference from the MSL to the AssociationSet var ecm = parent.GetParentOfType(typeof(EntityContainerMapping)) as EntityContainerMapping; if (ecm != null) { entityContainerName = ecm.CdmEntityContainer.RefName; } } Symbol symbol = null; if (!string.IsNullOrEmpty(entityContainerName)) { symbol = new Symbol(entityContainerName, refName); } if (symbol == null) { symbol = new Symbol(refName); } var normalizedName = new NormalizedName(symbol, null, null, refName); return normalizedName; }
internal static NormalizedName NameNormalizer(EFElement parent, string refName) { Debug.Assert(parent != null, "parent should not be null"); if (refName == null) { return null; } var parentAssociationSetEnd = parent as AssociationSetEnd; var parentEndProperty = parent as EndProperty; var parentFunctionAssociationEnd = parent as FunctionAssociationEnd; var symbol = new Symbol(); if (parentAssociationSetEnd != null) { // we are coming up with the object's name for the first time var assocSet = parentAssociationSetEnd.Parent as AssociationSet; if (assocSet != null) { var ec = assocSet.Parent as BaseEntityContainer; if (ec != null) { symbol = new Symbol(ec.EntityContainerName, assocSet.LocalName.Value, refName); } } } else if (parentEndProperty != null) { // this end is inside an AssociationSetMapping, so we derive the end's name based on the set's name var asm = parentEndProperty.Parent as AssociationSetMapping; if (asm.Name.Status == BindingStatus.Known) { symbol = new Symbol(asm.Name.Target.NormalizedName, refName); } } else if (parentFunctionAssociationEnd != null) { // this end is inside of a function mapping if (parentFunctionAssociationEnd.AssociationSet.Status == BindingStatus.Known) { symbol = new Symbol(parentFunctionAssociationEnd.AssociationSet.Target.NormalizedName, refName); } } var normalizedName = new NormalizedName(symbol, null, null, refName); return normalizedName; }
internal static NormalizedName NameNormalizer(EFElement parent, string refName) { Debug.Assert(parent != null, "parent should not be null"); if (refName == null) { return null; } NormalizedName normalizedName = null; var parentAssociation = parent as Association; var parentAssociationSet = parent as AssociationSet; var parentAssociationSetMapping = parent as AssociationSetMapping; var parentNavigationProperty = parent as NavigationProperty; if (parentAssociation != null) { var model = parentAssociation.Parent as BaseEntityModel; if (model != null) { // we are coming up with the object's name for the first time var symbol = new Symbol(model.NamespaceValue, parentAssociation.LocalName.Value); normalizedName = new NormalizedName(symbol, null, null, parentAssociation.LocalName.Value); } } else if (parentAssociationSet != null) { // we are wanting to resolve a reference from an Association Set that may or may not // use the alias defined in the EntityModel normalizedName = EFNormalizableItemDefaults.DefaultNameNormalizerForEDM(parentAssociationSet, refName); } else if (parentAssociationSetMapping != null) { normalizedName = EFNormalizableItemDefaults.DefaultNameNormalizerForMSL(parentAssociationSetMapping, refName); } else if (parentNavigationProperty != null) { normalizedName = EFNormalizableItemDefaults.DefaultNameNormalizerForEDM(parentNavigationProperty, refName); } if (normalizedName == null) { var symbol = new Symbol(refName); normalizedName = new NormalizedName(symbol, null, null, refName); } return normalizedName; }
internal static NormalizedName NameNormalizer(EFElement parent, string refName) { Debug.Assert(parent != null, "parent should not be null"); if (refName == null) { return null; } var entityContainerName = string.Empty; var parentFunctionImport = parent as FunctionImport; var parentFunctionImportMapping = parent as FunctionImportMapping; Symbol symbol = null; // are we trying to normalize the name of actual FunctionImport in the EC? if (parentFunctionImport != null) { var ec = parentFunctionImport.Parent as BaseEntityContainer; if (ec != null) { entityContainerName = ec.EntityContainerName; } } else if (parentFunctionImportMapping != null) { var ecm = parentFunctionImportMapping.Parent as EntityContainerMapping; if (ecm != null) { entityContainerName = ecm.CdmEntityContainer.RefName; } } if (!string.IsNullOrEmpty(entityContainerName)) { symbol = new Symbol(entityContainerName, refName); } if (symbol == null) { symbol = new Symbol(refName); } var normalizedName = new NormalizedName(symbol, null, null, refName); return normalizedName; }
internal static NormalizedName ReferentialConstraintRoleNameNormalizer(EFElement parent, string refName) { var role = parent as ReferentialConstraintRole; Debug.Assert(role != null, "role should not be null"); var rc = role.Parent as ReferentialConstraint; Debug.Assert(rc != null, "role.Parent should be a ReferentialConstraint"); var assoc = rc.Parent as Association; Debug.Assert(assoc != null, "referential constraint parent should be a Association"); var symbol = new Symbol(assoc.EntityModel.NamespaceValue, assoc.LocalName.Value, refName); var normalizedName = new NormalizedName(symbol, null, null, refName); return(normalizedName); }
internal static NormalizedName NavigationPropertyRoleNameNormalizer(EFElement parent, string refName) { var navProperty = parent as NavigationProperty; NormalizedName normalizedName = null; if (navProperty != null) { var symbol = new Symbol(navProperty.Relationship.NormalizedName(), refName); normalizedName = new NormalizedName(symbol, null, null, refName); } if (normalizedName == null) { var symbol = new Symbol(refName); normalizedName = new NormalizedName(symbol, null, null, refName); } return(normalizedName); }
internal static NormalizedName FunctionImportEntitySetNameNormalizer(EFElement parent, string refName) { Debug.Assert(parent != null, "parent should not be null"); if (refName == null) { return(null); } // cast the parameter to what this really is var fi = parent as FunctionImport; Debug.Assert(fi != null, "parent should be a " + typeof(FunctionImport)); // get the entity container name Symbol entityContainerName = null; var ec = fi.Parent as BaseEntityContainer; if (ec != null) { entityContainerName = ec.NormalizedName; } Symbol symbol = null; if (entityContainerName != null) { // the normalized name for an EntitySet is 'EntityContainerName + # + EntitySetName' symbol = new Symbol(entityContainerName, refName); } if (symbol == null) { symbol = new Symbol(refName); } var normalizedName = new NormalizedName(symbol, null, null, refName); return(normalizedName); }
internal static NormalizedName NameNormalizer(EFElement parent, string refName) { Debug.Assert(parent != null, "parent should not be null"); if (refName == null) { return null; } NormalizedName normalizedName = null; // cast the parameter to what this really is var end = parent as AssociationSetEnd; Debug.Assert(end != null, "parent should be an AssociationSetEnd"); // get the assoc set var set = end.Parent as AssociationSet; Debug.Assert(set != null, "end.Parent should be an AssociationSet"); // the "Role" attribute points to a "Role" attribute in an Association End. The trick // is that this attribute is optional and defaults to the raw name of the Entity pointed // to by the "Type" attribute of the Association End, and that might not be fully resolved // yet. So, lets just get the Normalized Name for the assocation from the assocation set //and tack on the Role name. if (set.Association.Status == BindingStatus.Known) { var assocNameRef = AssociationNameNormalizer.NameNormalizer(set.Association.Target, set.Association.RefName); var assocSymbol = assocNameRef.Symbol; var assocSetEndRoleSymbol = new Symbol(assocSymbol, refName); normalizedName = new NormalizedName(assocSetEndRoleSymbol, null, null, refName); } if (normalizedName == null) { var symbol = new Symbol(refName); normalizedName = new NormalizedName(symbol, null, null, refName); } return normalizedName; }
/// <summary> /// Normalize a refName where the refName is a child of a FunctionComplexProperty /// </summary> /// <param name="fcp"></param> /// <param name="refName"></param> /// <returns></returns> internal static NormalizedName NormalizeNameRelativeToFunctionComplexProperty(FunctionComplexProperty fcp, string refName) { NormalizedName nn = null; if (fcp != null) { // for FunctionComplexProperty mapping we create Symbol from corresponding ComplexType if (fcp.Name.Status == BindingStatus.Known) { var complexType = fcp.Name.Target.ComplexType.Target; if (complexType != null) { var symbol = new Symbol(complexType.NormalizedName, refName); nn = new NormalizedName(symbol, null, null, refName); } } } return nn; }
/// <summary> /// Normalize a refName where the refName is a child of a EntityTypeMapping /// <param name="etm"></param> /// <param name="fae"></param> /// <param name="parent"></param> /// <param name="refName"></param> /// <returns></returns> internal static NormalizedName NormalizePropertyNameRelativeToEntityTypeMapping( EntityTypeMapping etm, EFElement parent, string refName) { NormalizedName nn = null; if (etm != null && etm.TypeName.Status == (int)BindingStatus.Known) { // walk up until we find our EntityTypeMapping, then we can walk over to the EntityType(s) // that should contain this property name foreach (var binding in etm.TypeName.Bindings) { if (binding.Status == BindingStatus.Known) { var cet = binding.Target as ConceptualEntityType; Debug.Assert(cet != null, "EntityType is not EntityTypeMapping"); // for each entity type in the list, look to see it contains the property // if not, then check its parent var typesToCheck = new List<ConceptualEntityType>(); typesToCheck.Add(cet); typesToCheck.AddRange(cet.ResolvableBaseTypes); foreach (EntityType entityType in typesToCheck) { var entityTypeSymbol = entityType.NormalizedName; var symbol = new Symbol(entityTypeSymbol, refName); var artifactSet = parent.Artifact.ModelManager.GetArtifactSet(parent.Artifact.Uri); var item = artifactSet.LookupSymbol(symbol); if (item != null) { nn = new NormalizedName(symbol, null, null, refName); } } } } } return nn; }
/// <summary> /// return a new NormalizedName for a refName that is a child of ComplexProperty /// </summary> /// <param name="cp"></param> /// <param name="refName"></param> /// <returns></returns> private static NormalizedName NormalizePropertyNameRelativeToComplexProperty(ComplexProperty cp, string refName) { NormalizedName nn = null; if (cp != null) { // for complex property mapping we create Symbol from corresponding ComplexType if (cp.Name.Status == BindingStatus.Known) { var complexType = cp.Name.Target.ComplexType.Target; if (complexType != null) { var symbol = new Symbol(complexType.NormalizedName, refName); nn = new NormalizedName(symbol, null, null, refName); } } } return nn; }
internal static NormalizedName NameNormalizer(EFElement parent, string refName) { Debug.Assert(parent != null, "parent should not be null"); Symbol symbol = null; if (refName == null) { return(null); } var entityContainerName = string.Empty; var parentEntitySet = parent as EntitySet; var parentEntitySetMapping = parent as EntitySetMapping; var parentMappingFragment = parent as MappingFragment; var parentAssociationSetMapping = parent as AssociationSetMapping; if (parentEntitySet != null) { // we are trying to normalize the name of actual entity set in the EC var ec = parentEntitySet.Parent as BaseEntityContainer; if (ec != null) { entityContainerName = ec.EntityContainerName; } } else if (parentEntitySetMapping != null) { // we are trying to normalize the name reference to an EntitySet in the // C-space from an EntitySetMapping var ecm = parentEntitySetMapping.Parent as EntityContainerMapping; if (ecm != null) { entityContainerName = ecm.CdmEntityContainer.RefName; } } else if (parentMappingFragment != null) { // we are trying to normalize the name reference to an EntitySet in the // S-space from a MappingFragment var ecm = parentMappingFragment.GetParentOfType(typeof(EntityContainerMapping)) as EntityContainerMapping; if (ecm != null) { entityContainerName = ecm.StorageEntityContainer.RefName; } } else if (parentAssociationSetMapping != null) { // we are trying to normalize the name reference "TableName" in an // AssociationSetMapping back to an EntitySet in S-Space var ecm = parentAssociationSetMapping.GetParentOfType(typeof(EntityContainerMapping)) as EntityContainerMapping; if (ecm != null) { entityContainerName = ecm.StorageEntityContainer.RefName; } } if (!string.IsNullOrEmpty(entityContainerName)) { symbol = new Symbol(entityContainerName, refName); } if (symbol == null) { symbol = new Symbol(refName); } var normalizedName = new NormalizedName(symbol, null, null, refName); return(normalizedName); }
internal static NormalizedName ReferentialConstraintRoleNameNormalizer(EFElement parent, string refName) { var role = parent as ReferentialConstraintRole; Debug.Assert(role != null, "role should not be null"); var rc = role.Parent as ReferentialConstraint; Debug.Assert(rc != null, "role.Parent should be a ReferentialConstraint"); var assoc = rc.Parent as Association; Debug.Assert(assoc != null, "referential constraint parent should be a Association"); var symbol = new Symbol(assoc.EntityModel.NamespaceValue, assoc.LocalName.Value, refName); var normalizedName = new NormalizedName(symbol, null, null, refName); return normalizedName; }
internal static NormalizedName NameNormalizer(EFElement parent, string refName) { Debug.Assert(parent != null, "parent should not be null"); Symbol symbol = null; if (refName == null) { return null; } var entityContainerName = string.Empty; var parentEntitySet = parent as EntitySet; var parentEntitySetMapping = parent as EntitySetMapping; var parentMappingFragment = parent as MappingFragment; var parentAssociationSetMapping = parent as AssociationSetMapping; if (parentEntitySet != null) { // we are trying to normalize the name of actual entity set in the EC var ec = parentEntitySet.Parent as BaseEntityContainer; if (ec != null) { entityContainerName = ec.EntityContainerName; } } else if (parentEntitySetMapping != null) { // we are trying to normalize the name reference to an EntitySet in the // C-space from an EntitySetMapping var ecm = parentEntitySetMapping.Parent as EntityContainerMapping; if (ecm != null) { entityContainerName = ecm.CdmEntityContainer.RefName; } } else if (parentMappingFragment != null) { // we are trying to normalize the name reference to an EntitySet in the // S-space from a MappingFragment var ecm = parentMappingFragment.GetParentOfType(typeof(EntityContainerMapping)) as EntityContainerMapping; if (ecm != null) { entityContainerName = ecm.StorageEntityContainer.RefName; } } else if (parentAssociationSetMapping != null) { // we are trying to normalize the name reference "TableName" in an // AssociationSetMapping back to an EntitySet in S-Space var ecm = parentAssociationSetMapping.GetParentOfType(typeof(EntityContainerMapping)) as EntityContainerMapping; if (ecm != null) { entityContainerName = ecm.StorageEntityContainer.RefName; } } if (!string.IsNullOrEmpty(entityContainerName)) { symbol = new Symbol(entityContainerName, refName); } if (symbol == null) { symbol = new Symbol(refName); } var normalizedName = new NormalizedName(symbol, null, null, refName); return normalizedName; }
internal static NormalizedName NameNormalizer(EFElement parent, string refName) { Debug.Assert(parent != null, "parent should not be null"); if (refName == null) { return(null); } var parentItem = parent; Debug.Assert(parentItem != null, "parent.Parent should be an EFElement"); var frag = parentItem.GetParentOfType(typeof(MappingFragment)) as MappingFragment; var asm = parentItem.GetParentOfType(typeof(AssociationSetMapping)) as AssociationSetMapping; Symbol symbol = null; if (frag != null && frag.StoreEntitySet.Status == BindingStatus.Known) { // walk up until we find our MappingFragment, then we can walk to the EntitySet in the S-Space // that has the EntityType that contains the column var storageSpaceEntitySet = frag.StoreEntitySet.Target; if (storageSpaceEntitySet != null) { if (storageSpaceEntitySet.EntityType.Target != null) { var entityTypeSymbol = storageSpaceEntitySet.EntityType.Target.NormalizedName; var propertySymbol = new Symbol(entityTypeSymbol, refName); var artifactSet = parent.Artifact.ModelManager.GetArtifactSet(parent.Artifact.Uri); var item = artifactSet.LookupSymbol(propertySymbol); if (item != null) { return(new NormalizedName(propertySymbol, null, null, refName)); } } } } else if (asm != null) { // this is a condition under an AssocationSetMapping or a ScalarProperty under an EndProperty // regardless, use the reference to our S-Space from the asm if (asm.StoreEntitySet.Status == BindingStatus.Known) { var set = asm.StoreEntitySet.Target; // Note: set.EntityType.Target can be null for e.g. an asm with a StoreEntitySet attribute // which points to a non-existent EntitySet if (null != set && null != set.EntityType && null != set.EntityType.Target && set.EntityType.Status == BindingStatus.Known) { var type = set.EntityType.Target; symbol = new Symbol(type.NormalizedName, refName); } } } if (symbol == null) { symbol = new Symbol(refName); } var normalizedName = new NormalizedName(symbol, null, null, refName); return(normalizedName); }
internal static NormalizedName NameNormalizer(EFElement parent, string refName) { Debug.Assert(parent != null, "parent should not be null"); if (refName == null) { return null; } var parentItem = parent; Debug.Assert(parentItem != null, "parent.Parent should be an EFElement"); var frag = parentItem.GetParentOfType(typeof(MappingFragment)) as MappingFragment; var asm = parentItem.GetParentOfType(typeof(AssociationSetMapping)) as AssociationSetMapping; Symbol symbol = null; if (frag != null && frag.StoreEntitySet.Status == BindingStatus.Known) { // walk up until we find our MappingFragment, then we can walk to the EntitySet in the S-Space // that has the EntityType that contains the column var storageSpaceEntitySet = frag.StoreEntitySet.Target; if (storageSpaceEntitySet != null) { if (storageSpaceEntitySet.EntityType.Target != null) { var entityTypeSymbol = storageSpaceEntitySet.EntityType.Target.NormalizedName; var propertySymbol = new Symbol(entityTypeSymbol, refName); var artifactSet = parent.Artifact.ModelManager.GetArtifactSet(parent.Artifact.Uri); var item = artifactSet.LookupSymbol(propertySymbol); if (item != null) { return new NormalizedName(propertySymbol, null, null, refName); } } } } else if (asm != null) { // this is a condition under an AssocationSetMapping or a ScalarProperty under an EndProperty // regardless, use the reference to our S-Space from the asm if (asm.StoreEntitySet.Status == BindingStatus.Known) { var set = asm.StoreEntitySet.Target; // Note: set.EntityType.Target can be null for e.g. an asm with a StoreEntitySet attribute // which points to a non-existent EntitySet if (null != set && null != set.EntityType && null != set.EntityType.Target && set.EntityType.Status == BindingStatus.Known) { var type = set.EntityType.Target; symbol = new Symbol(type.NormalizedName, refName); } } } if (symbol == null) { symbol = new Symbol(refName); } var normalizedName = new NormalizedName(symbol, null, null, refName); return normalizedName; }
internal static NormalizedName NameNormalizer(EFElement parent, string refName) { Debug.Assert(parent != null, "parent should not be null"); if (refName == null) { return null; } var entityType = parent as EntityType; var complexType = parent as ComplexType; var property = parent as Property; var navigationProperty = parent as NavigationProperty; Symbol symbol = null; if (entityType != null) { var em = entityType.Parent as BaseEntityModel; if (em != null) { symbol = new Symbol(em.NamespaceValue, entityType.LocalName.Value, refName); } } else if (complexType != null) { var em = complexType.Parent as BaseEntityModel; if (em != null) { symbol = new Symbol(em.NamespaceValue, complexType.LocalName.Value, refName); } } else if (property != null || navigationProperty != null) { var et = parent.Parent as EntityType; if (et != null) { var em = et.Parent as BaseEntityModel; if (em != null) { symbol = new Symbol(em.NamespaceValue, et.LocalName.Value, refName); } } else { var ct = parent.Parent as ComplexType; if (ct != null) { var em = ct.Parent as BaseEntityModel; if (em != null) { symbol = new Symbol(em.NamespaceValue, ct.LocalName.Value, refName); } } } } if (symbol == null) { symbol = new Symbol(refName); } var normalizedName = new NormalizedName(symbol, null, null, refName); return normalizedName; }
public bool Equals(GeneralUser input) { if (input == null) { return(false); } return (( MembershipId == input.MembershipId || (MembershipId.Equals(input.MembershipId)) ) && ( UniqueName == input.UniqueName || (UniqueName != null && UniqueName.Equals(input.UniqueName)) ) && ( NormalizedName == input.NormalizedName || (NormalizedName != null && NormalizedName.Equals(input.NormalizedName)) ) && ( DisplayName == input.DisplayName || (DisplayName != null && DisplayName.Equals(input.DisplayName)) ) && ( ProfilePicture == input.ProfilePicture || (ProfilePicture.Equals(input.ProfilePicture)) ) && ( ProfileTheme == input.ProfileTheme || (ProfileTheme.Equals(input.ProfileTheme)) ) && ( UserTitle == input.UserTitle || (UserTitle.Equals(input.UserTitle)) ) && ( SuccessMessageFlags == input.SuccessMessageFlags || (SuccessMessageFlags.Equals(input.SuccessMessageFlags)) ) && ( IsDeleted == input.IsDeleted || (IsDeleted != null && IsDeleted.Equals(input.IsDeleted)) ) && ( About == input.About || (About != null && About.Equals(input.About)) ) && ( FirstAccess == input.FirstAccess || (FirstAccess != null && FirstAccess.Equals(input.FirstAccess)) ) && ( LastUpdate == input.LastUpdate || (LastUpdate != null && LastUpdate.Equals(input.LastUpdate)) ) && ( LegacyPortalUid == input.LegacyPortalUid || (LegacyPortalUid.Equals(input.LegacyPortalUid)) ) && ( Context == input.Context || (Context != null && Context.Equals(input.Context)) ) && ( PsnDisplayName == input.PsnDisplayName || (PsnDisplayName != null && PsnDisplayName.Equals(input.PsnDisplayName)) ) && ( XboxDisplayName == input.XboxDisplayName || (XboxDisplayName != null && XboxDisplayName.Equals(input.XboxDisplayName)) ) && ( FbDisplayName == input.FbDisplayName || (FbDisplayName != null && FbDisplayName.Equals(input.FbDisplayName)) ) && ( ShowActivity == input.ShowActivity || (ShowActivity != null && ShowActivity.Equals(input.ShowActivity)) ) && ( Locale == input.Locale || (Locale != null && Locale.Equals(input.Locale)) ) && ( LocaleInheritDefault == input.LocaleInheritDefault || (LocaleInheritDefault != null && LocaleInheritDefault.Equals(input.LocaleInheritDefault)) ) && ( LastBanReportId == input.LastBanReportId || (LastBanReportId.Equals(input.LastBanReportId)) ) && ( ShowGroupMessaging == input.ShowGroupMessaging || (ShowGroupMessaging != null && ShowGroupMessaging.Equals(input.ShowGroupMessaging)) ) && ( ProfilePicturePath == input.ProfilePicturePath || (ProfilePicturePath != null && ProfilePicturePath.Equals(input.ProfilePicturePath)) ) && ( ProfilePictureWidePath == input.ProfilePictureWidePath || (ProfilePictureWidePath != null && ProfilePictureWidePath.Equals(input.ProfilePictureWidePath)) ) && ( ProfileThemeName == input.ProfileThemeName || (ProfileThemeName != null && ProfileThemeName.Equals(input.ProfileThemeName)) ) && ( UserTitleDisplay == input.UserTitleDisplay || (UserTitleDisplay != null && UserTitleDisplay.Equals(input.UserTitleDisplay)) ) && ( StatusText == input.StatusText || (StatusText != null && StatusText.Equals(input.StatusText)) ) && ( StatusDate == input.StatusDate || (StatusDate != null && StatusDate.Equals(input.StatusDate)) ) && ( ProfileBanExpire == input.ProfileBanExpire || (ProfileBanExpire != null && ProfileBanExpire.Equals(input.ProfileBanExpire)) ) && ( BlizzardDisplayName == input.BlizzardDisplayName || (BlizzardDisplayName != null && BlizzardDisplayName.Equals(input.BlizzardDisplayName)) ) && ( SteamDisplayName == input.SteamDisplayName || (SteamDisplayName != null && SteamDisplayName.Equals(input.SteamDisplayName)) ) && ( StadiaDisplayName == input.StadiaDisplayName || (StadiaDisplayName != null && StadiaDisplayName.Equals(input.StadiaDisplayName)) ) && ( TwitchDisplayName == input.TwitchDisplayName || (TwitchDisplayName != null && TwitchDisplayName.Equals(input.TwitchDisplayName)) ) && ( CachedBungieGlobalDisplayName == input.CachedBungieGlobalDisplayName || (CachedBungieGlobalDisplayName != null && CachedBungieGlobalDisplayName.Equals(input.CachedBungieGlobalDisplayName)) ) && ( CachedBungieGlobalDisplayNameCode == input.CachedBungieGlobalDisplayNameCode || (CachedBungieGlobalDisplayNameCode.Equals(input.CachedBungieGlobalDisplayNameCode)) )); }
internal static NormalizedName NavigationPropertyRoleNameNormalizer(EFElement parent, string refName) { var navProperty = parent as NavigationProperty; NormalizedName normalizedName = null; if (navProperty != null) { var symbol = new Symbol(navProperty.Relationship.NormalizedName(), refName); normalizedName = new NormalizedName(symbol, null, null, refName); } if (normalizedName == null) { var symbol = new Symbol(refName); normalizedName = new NormalizedName(symbol, null, null, refName); } return normalizedName; }
internal static NormalizedName NameNormalizer(EFElement parent, string refName) { Debug.Assert(parent != null, "parent should not be null"); if (refName == null) { return(null); } var entityType = parent as EntityType; var complexType = parent as ComplexType; var property = parent as Property; var navigationProperty = parent as NavigationProperty; Symbol symbol = null; if (entityType != null) { var em = entityType.Parent as BaseEntityModel; if (em != null) { symbol = new Symbol(em.NamespaceValue, entityType.LocalName.Value, refName); } } else if (complexType != null) { var em = complexType.Parent as BaseEntityModel; if (em != null) { symbol = new Symbol(em.NamespaceValue, complexType.LocalName.Value, refName); } } else if (property != null || navigationProperty != null) { var et = parent.Parent as EntityType; if (et != null) { var em = et.Parent as BaseEntityModel; if (em != null) { symbol = new Symbol(em.NamespaceValue, et.LocalName.Value, refName); } } else { var ct = parent.Parent as ComplexType; if (ct != null) { var em = ct.Parent as BaseEntityModel; if (em != null) { symbol = new Symbol(em.NamespaceValue, ct.LocalName.Value, refName); } } } } if (symbol == null) { symbol = new Symbol(refName); } var normalizedName = new NormalizedName(symbol, null, null, refName); return(normalizedName); }