public bool IsMatch(MappingProperty mappingProperty) { return ((mappingProperty.IsTypeOfString() || mappingProperty.IsTypeOfByteArray()) && mappingProperty.HasFacet(DbProviderManifest.FixedLengthFacetName) && mappingProperty.GetFacetValue <bool>(DbProviderManifest.FixedLengthFacetName)); }
public bool IsMatch(MappingProperty mappingProperty) { return (mappingProperty.IsTypeOfString() && mappingProperty.HasFacet(DbProviderManifest.UnicodeFacetName) && mappingProperty.GetFacetValue <bool>(DbProviderManifest.UnicodeFacetName)); }
public bool IsMatch(MappingProperty mappingProperty) { return (mappingProperty.IsTypeOfByteArray() && mappingProperty.HasFacet(DbProviderManifest.MaxLengthFacetName) && mappingProperty.GetFacet(DbProviderManifest.MaxLengthFacetName).IsUnbounded == false && mappingProperty.GetFacetValue <int>(DbProviderManifest.MaxLengthFacetName) == 8 && mappingProperty.IsStoreGeneratedComputed); }
private MappingPropertyView Create(EntityType entityType, MappingProperty mappingProperty) { var mappingPropertyView = new MappingPropertyView(); mappingPropertyView.ConceptualName = mappingProperty.Name; mappingPropertyView.Attributes.AddRange( this.CreateAttributes(entityType, mappingProperty)); return(mappingPropertyView); }
public bool IsMatch(MappingProperty mappingProperty) { return ((mappingProperty.IsTypeOfString() || mappingProperty.IsTypeOfByteArray()) && mappingProperty.HasFacet(DbProviderManifest.MaxLengthFacetName) && !mappingProperty.GetFacet(DbProviderManifest.MaxLengthFacetName).IsUnbounded&& // XXX: I (currently) have no clue how to write a simple test for this. For some // reason a varchar(max) or nvarchar(max) did not have IsUnbounded set, so this // match did not fire, and thereby caused the code to emit a superfluous // .HasMaxLength(2^31) or .HasMaxLength(2^30) respectively. The hack (below) is // my current work around, but I think it is stupid. !this.IsMaxType(mappingProperty.TypeName)); }
private IEnumerable <string> CreateAttributes(EntityType entityType, MappingProperty mappingProperty) { var mappingViewIsRequired = new MappingPropertyMatcherIsRequired(); if (mappingViewIsRequired.IsMatch(mappingProperty)) { yield return(".IsRequired()"); } var mappingViewIsFixedLength = new MappingPropertyMatcherIsFixedLength(); if (mappingViewIsFixedLength.IsMatch(mappingProperty)) { yield return(".IsFixedLength()"); } var mappingViewMaxLength = new MappingPropertyMatcherMaxLength(); if (mappingViewMaxLength.IsMatch(mappingProperty)) { yield return($".HasMaxLength({mappingViewMaxLength.GetMaxLength(mappingProperty)})"); } var mappingViewIsRowVersion = new MappingPropertyMatcherIsRowVersion(); if (mappingViewIsRowVersion.IsMatch(mappingProperty)) { yield return(".IsRowVersion()"); } var mappingViewHasStoreGeneratedPattern = new MappingPropertyMatcherHasStoreGeneratedPattern(entityType); if (mappingViewHasStoreGeneratedPattern.IsMatch(mappingProperty)) { yield return($".HasDatabaseGeneratedOption(DatabaseGeneratedOption.{mappingViewHasStoreGeneratedPattern.GetStoreGeneratedPattern(mappingProperty)})"); } }
private bool IsKey(MappingProperty mappingProperty) { return(this.entityType.KeyProperties.Any(x => x.Name == mappingProperty.Name)); }
private bool IsStoreGeneratedPatternIdentity(MappingProperty mappingProperty) { return ((!this.IsKey(mappingProperty) || this.HasMultipleKeys()) && mappingProperty.IsStoreGeneratedIdentity); }
private bool IsStoreGeneratedPatternNone(MappingProperty mappingProperty) { return (this.IsKey(mappingProperty) && !mappingProperty.IsStoreGeneratedIdentity); }
public StoreGeneratedPattern GetStoreGeneratedPattern(MappingProperty mappingProperty) { return((this.IsStoreGeneratedPatternNone(mappingProperty)) ? StoreGeneratedPattern.None : StoreGeneratedPattern.Identity); }
public bool IsMatch(MappingProperty mappingProperty) { return (mappingProperty.IsTypeOfNumericKey() && (this.IsStoreGeneratedPatternNone(mappingProperty) || this.IsStoreGeneratedPatternIdentity(mappingProperty))); }
public int GetMaxLength(MappingProperty mappingProperty) { return(mappingProperty.GetFacetValue <int>(DbProviderManifest.MaxLengthFacetName)); }