internal static void ExtractNamespaceAndName(string qualifiedTypeName, out string namespaceName, out string name) { DebugCheck.NotEmpty(qualifiedTypeName); GetBeforeAndAfterLastPeriod(qualifiedTypeName, out namespaceName, out name); }
private InitializerMetadata(Type clrType) { DebugCheck.NotNull(clrType); ClrType = clrType; Identity = _identifierPrefix + Interlocked.Increment(ref s_identifier).ToString(CultureInfo.InvariantCulture); }
internal EntityCollectionInitializerMetadata(Type type, NavigationProperty navigationProperty) : base(type) { DebugCheck.NotNull(navigationProperty); _navigationProperty = navigationProperty; }
// effects: Given a list of cells in the schema, generates the query and // update mapping views for OFTYPE(Extent, Type) combinations in this schema // container. Returns a list of generated query and update views. // If it is false and some columns in a table are unmapped, an // exception is raised private static ViewGenResults GenerateViewsFromCells( List <Cell> cells, ConfigViewGenerator config, CqlIdentifiers identifiers, EntityContainerMapping containerMapping) { DebugCheck.NotNull(cells); DebugCheck.NotNull(config); Debug.Assert(cells.Count > 0, "There must be at least one cell in the container mapping"); // Go through each table and determine their foreign key constraints var container = containerMapping.StorageEntityContainer; Debug.Assert(container != null); var viewGenResults = new ViewGenResults(); var tmpLog = EnsureAllCSpaceContainerSetsAreMapped(cells, containerMapping); if (tmpLog.Count > 0) { viewGenResults.AddErrors(tmpLog); Helpers.StringTraceLine(viewGenResults.ErrorsToString()); return(viewGenResults); } var foreignKeyConstraints = ForeignConstraint.GetForeignConstraints(container); var partitioner = new CellPartitioner(cells, foreignKeyConstraints); var cellGroups = partitioner.GroupRelatedCells(); foreach (var cellGroup in cellGroups) { ViewGenerator viewGenerator = null; var groupErrorLog = new ErrorLog(); try { viewGenerator = new ViewGenerator(cellGroup, config, foreignKeyConstraints, containerMapping); } catch (InternalMappingException exception) { // All exceptions have mapping errors in them Debug.Assert(exception.ErrorLog.Count > 0, "Incorrectly created mapping exception"); groupErrorLog = exception.ErrorLog; } if (groupErrorLog.Count == 0) { Debug.Assert(viewGenerator != null); groupErrorLog = viewGenerator.GenerateAllBidirectionalViews(viewGenResults.Views, identifiers); } if (groupErrorLog.Count != 0) { viewGenResults.AddErrors(groupErrorLog); } } // We used to print the errors here. Now we trace them as they are being thrown //if (viewGenResults.HasErrors && config.IsViewTracing) { // Helpers.StringTraceLine(viewGenResults.ErrorsToString()); //} return(viewGenResults); }
// <summary> // Validates that the given name is a property of the declaring type (either on the CLR type or in the EDM) // and that it is a complex or scalar property rather than a nav property and then returns metadata about // the property. // </summary> // <param name="internalContext"> The internal context. </param> // <param name="declaringType"> The type that the property is declared on. </param> // <param name="requestedType"> The type of property requested, which may be 'object' if any type can be accepted. </param> // <param name="propertyName"> Name of the property. </param> // <returns> Metadata about the property, or null if the property does not exist or is a navigation property. </returns> public static PropertyEntryMetadata ValidateNameAndGetMetadata( InternalContext internalContext, Type declaringType, Type requestedType, string propertyName) { DebugCheck.NotNull(internalContext); DebugCheck.NotNull(declaringType); DebugCheck.NotNull(requestedType); DebugCheck.NotEmpty(propertyName); Type propertyType; DbHelpers.GetPropertyTypes(declaringType).TryGetValue(propertyName, out propertyType); var metadataWorkspace = internalContext.ObjectContext.MetadataWorkspace; var edmType = metadataWorkspace.GetItem <StructuralType>(declaringType.FullNameWithNesting(), DataSpace.OSpace); var isMapped = false; var isComplex = false; EdmMember member; edmType.Members.TryGetValue(propertyName, false, out member); if (member != null) { // If the property is in the model, then it must be a scalar or complex property, not a nav prop var edmProperty = member as EdmProperty; if (edmProperty == null) { return(null); } if (propertyType == null) { var asPrimitive = edmProperty.TypeUsage.EdmType as PrimitiveType; if (asPrimitive != null) { propertyType = asPrimitive.ClrEquivalentType; } else { Debug.Assert( edmProperty.TypeUsage.EdmType is StructuralType, "Expected a structural type if property type is not primitive."); var objectItemCollection = (ObjectItemCollection)metadataWorkspace.GetItemCollection(DataSpace.OSpace); propertyType = objectItemCollection.GetClrType((StructuralType)edmProperty.TypeUsage.EdmType); } } isMapped = true; isComplex = edmProperty.TypeUsage.EdmType.BuiltInTypeKind == BuiltInTypeKind.ComplexType; } else { // If the prop is not in the model, then it must have a getter or a setter var propertyGetters = DbHelpers.GetPropertyGetters(declaringType); var propertySetters = DbHelpers.GetPropertySetters(declaringType); if (!(propertyGetters.ContainsKey(propertyName) || propertySetters.ContainsKey(propertyName))) { return(null); } Debug.Assert(propertyType != null, "If the property has a getter or setter, then it must exist and have a type."); } if (!requestedType.IsAssignableFrom(propertyType)) { throw Error.DbEntityEntry_WrongGenericForProp( propertyName, declaringType.Name, requestedType.Name, propertyType.Name); } return(new PropertyEntryMetadata(declaringType, propertyType, propertyName, isMapped, isComplex)); }
public static Type GetClrType(this EntityType entityType) { DebugCheck.NotNull(entityType); return(entityType.Annotations.GetClrType()); }
public static DatabaseName GetTableName(this EntityType table) { DebugCheck.NotNull(table); return((DatabaseName)table.Annotations.GetAnnotation(TableNameAnnotation)); }
// <summary> // REQUIRES:: entity exists; MergeOption is AppendOnly // Handles state management for an entity with the given key. When the entity already exists // in the state manager, it is returned directly. Otherwise, the entityDelegate is invoked and // the resulting entity is returned. // </summary> public IEntityWrapper HandleEntityAppendOnly <TEntity>( Func <Shaper, IEntityWrapper> constructEntityDelegate, EntityKey entityKey, EntitySet entitySet) { Debug.Assert(MergeOption == MergeOption.AppendOnly, "only use HandleEntityAppendOnly when MergeOption is AppendOnly"); DebugCheck.NotNull(constructEntityDelegate); IEntityWrapper result; if (null == (object)entityKey) { // no entity set, so no tracking is required for this entity, just // call the delegate to "materialize" it. result = constructEntityDelegate(this); RegisterMaterializedEntityForEvent(result); } else { Debug.Assert(null != entitySet, "if there is an entity key, there must also be an entity set"); // check for an existing entity with the same key var existingEntry = Context.ObjectStateManager.FindEntityEntry(entityKey); if (null != existingEntry && !existingEntry.IsKeyEntry) { Debug.Assert(existingEntry.EntityKey.Equals(entityKey), "Found ObjectStateEntry with wrong EntityKey"); if (typeof(TEntity) != existingEntry.WrappedEntity.IdentityType) { var key = existingEntry.EntityKey; throw new NotSupportedException( Strings.Materializer_RecyclingEntity( TypeHelpers.GetFullName(key.EntityContainerName, key.EntitySetName), typeof(TEntity).FullName, existingEntry.WrappedEntity.IdentityType.FullName)); } if (EntityState.Added == existingEntry.State) { throw new InvalidOperationException( Strings.Materializer_AddedEntityAlreadyExists(typeof(TEntity).FullName)); } result = existingEntry.WrappedEntity; } else { // We don't already have the entity, so construct it result = constructEntityDelegate(this); RegisterMaterializedEntityForEvent(result); if (null == existingEntry) { Context.ObjectStateManager.AddEntry(result, entityKey, entitySet, "HandleEntity", false); } else { Context.ObjectStateManager.PromoteKeyEntry( existingEntry, result, false, /*setIsLoaded*/ true, /*keyEntryInitialized*/ false); } } } return(result); }
// <summary> // Call to ensure a target entities key is added into the state manager // properly // </summary> public IEntityWrapper HandleRelationshipSpan( IEntityWrapper wrappedEntity, EntityKey targetKey, AssociationEndMember targetMember) { if (null == wrappedEntity.Entity) { return(wrappedEntity); } DebugCheck.NotNull(targetMember); Debug.Assert( targetMember.RelationshipMultiplicity == RelationshipMultiplicity.One || targetMember.RelationshipMultiplicity == RelationshipMultiplicity.ZeroOrOne); var sourceKey = wrappedEntity.EntityKey; var sourceMember = MetadataHelper.GetOtherAssociationEnd(targetMember); CheckClearedEntryOnSpan(targetKey, wrappedEntity, sourceKey, targetMember); if (null != (object)targetKey) { EntitySet targetEntitySet; var associationSet = Context.MetadataWorkspace.MetadataOptimization.FindCSpaceAssociationSet( (AssociationType)targetMember.DeclaringType, targetMember.Name, targetKey.EntitySetName, targetKey.EntityContainerName, out targetEntitySet); Debug.Assert(associationSet != null, "associationSet should not be null"); var manager = Context.ObjectStateManager; EntityState newEntryState; // If there is an existing relationship entry, update it based on its current state and the MergeOption, otherwise add a new one if ( !ObjectStateManager.TryUpdateExistingRelationships( Context, MergeOption, associationSet, sourceMember, sourceKey, wrappedEntity, targetMember, targetKey, /*setIsLoaded*/ true, out newEntryState)) { // Try to find a state entry for the target key var targetEntry = manager.GetOrAddKeyEntry(targetKey, targetEntitySet); // For 1-1 relationships we have to take care of the relationships of targetEntity var needNewRelationship = true; switch (sourceMember.RelationshipMultiplicity) { case RelationshipMultiplicity.ZeroOrOne: case RelationshipMultiplicity.One: // devnote: targetEntry can be a key entry (targetEntry.Entity == null), // but it that case this parameter won't be used in TryUpdateExistingRelationships needNewRelationship = !ObjectStateManager.TryUpdateExistingRelationships( Context, MergeOption, associationSet, targetMember, targetKey, targetEntry.WrappedEntity, sourceMember, sourceKey, setIsLoaded: true, newEntryState: out newEntryState); // It is possible that as part of removing existing relationships, the key entry was deleted // If that is the case, recreate the key entry if (targetEntry.State == EntityState.Detached) { targetEntry = manager.AddKeyEntry(targetKey, targetEntitySet); } break; case RelationshipMultiplicity.Many: // we always need a new relationship with Many-To-Many, if there was no exact match between these two entities, so do nothing break; default: Debug.Assert(false, "Unexpected sourceMember.RelationshipMultiplicity"); break; } if (needNewRelationship) { // If the target entry is a key entry, then we need to add a relation // between the source and target entries // If we are in a state where we just need to add a new Deleted relation, we // only need to do that and not touch the related ends // If the target entry is a full entity entry, then we need to add // the target entity to the source collection or reference if (targetEntry.IsKeyEntry || newEntryState == EntityState.Deleted) { // Add a relationship between the source entity and the target key entry var wrapper = new RelationshipWrapper( associationSet, sourceMember.Name, sourceKey, targetMember.Name, targetKey); manager.AddNewRelation(wrapper, newEntryState); } else { Debug.Assert(!targetEntry.IsRelationship, "how IsRelationship?"); if (targetEntry.State != EntityState.Deleted) { // The entry contains an entity, do collection or reference fixup // This will also try to create a new relationship entry or will revert the delete on an existing deleted relationship ObjectStateManager.AddEntityToCollectionOrReference( MergeOption, wrappedEntity, sourceMember, targetEntry.WrappedEntity, targetMember, setIsLoaded: true, relationshipAlreadyExists: false, inKeyEntryPromotion: false); } else { // if the target entry is deleted, then the materializer needs to create a deleted relationship // between the entity and the target entry so that if the entity is deleted, the update // pipeline can find the relationship (even though it is deleted) var wrapper = new RelationshipWrapper( associationSet, sourceMember.Name, sourceKey, targetMember.Name, targetKey); manager.AddNewRelation(wrapper, EntityState.Deleted); } } } } } else { RelatedEnd relatedEnd; if (TryGetRelatedEnd( wrappedEntity, (AssociationType)targetMember.DeclaringType, sourceMember.Name, targetMember.Name, out relatedEnd)) { SetIsLoadedForSpan(relatedEnd, false); } } // else there is nothing else for us to do, the relationship has been handled already return(wrappedEntity); }
public EntityType MapEntityType(Type type) { DebugCheck.NotNull(type); if (!type.IsValidStructuralType() || _mappingContext.ModelConfiguration.IsIgnoredType(type) || _mappingContext.ModelConfiguration.IsComplexType(type)) { return(null); } var entityType = GetExistingEdmType <EntityType>(_mappingContext.Model, type); if (entityType == null) { _mappingContext.ConventionsConfiguration.ApplyModelConfiguration(type, _mappingContext.ModelConfiguration); if (_mappingContext.ModelConfiguration.IsIgnoredType(type) || _mappingContext.ModelConfiguration.IsComplexType(type)) { return(null); } entityType = _mappingContext.Model.AddEntityType(type.Name, _mappingContext.ModelConfiguration.ModelNamespace); entityType.Abstract = type.IsAbstract(); Debug.Assert(type.BaseType() != null); var baseType = _mappingContext.Model.GetEntityType(type.BaseType().Name); if (baseType == null) { _mappingContext.Model.AddEntitySet(entityType.Name, entityType); } else if (ReferenceEquals(baseType, entityType)) { throw new NotSupportedException(Strings.SimpleNameCollision(type.FullName, type.BaseType().FullName, type.Name)); } entityType.BaseType = baseType; var entityTypeConfiguration = new Func <EntityTypeConfiguration>(() => _mappingContext.ModelConfiguration.Entity(type)); _mappingContext.ConventionsConfiguration.ApplyTypeConfiguration( type, entityTypeConfiguration, _mappingContext.ModelConfiguration); // Defer the mapping of navigation properties in order to be able to sort them // without affecting the order of the other properties. var navigationProperties = new List <PropertyInfo>(); MapStructuralElements( type, entityType.GetMetadataProperties(), (m, p) => { if (!m.MapIfNotNavigationProperty(p, entityType, entityTypeConfiguration)) { navigationProperties.Add(p); } }, entityTypeConfiguration); var navigationPropertyInfos = (IEnumerable <PropertyInfo>)navigationProperties; if (_mappingContext.ModelBuilderVersion.IsEF6OrHigher()) { navigationPropertyInfos = navigationPropertyInfos.OrderBy(p => p.Name); } foreach (var propertyInfo in navigationPropertyInfos) { new NavigationPropertyMapper(this).Map(propertyInfo, entityType, entityTypeConfiguration); } if (entityType.BaseType != null) { LiftInheritedProperties(type, entityType); } MapDerivedTypes(type, entityType); } return(entityType); }
public IEntityWrapper HandleEntityNoTracking <TEntity>(IEntityWrapper wrappedEntity) { DebugCheck.NotNull(wrappedEntity); RegisterMaterializedEntityForEvent(wrappedEntity); return(wrappedEntity); }
/// <summary> /// Initializes a new instance of the <see cref="DbPropertyValues" /> class. /// </summary> /// <param name="internalValues"> The internal dictionary. </param> internal DbPropertyValues(InternalPropertyValues internalValues) { DebugCheck.NotNull(internalValues); _internalValues = internalValues; }
internal MetadataType(string name, TypeUsage typeUsage) : base(MetadataMemberClass.Type, name) { DebugCheck.NotNull(typeUsage); TypeUsage = typeUsage; }
internal static string ExtractTypeName(string qualifiedTypeName) { DebugCheck.NotEmpty(qualifiedTypeName); return(GetEverythingAfterLastPeriod(qualifiedTypeName)); }
public static IEnumerable <EdmProperty> KeyProperties(this EntityType entityType) { DebugCheck.NotNull(entityType); return(entityType.GetRootType().KeyProperties); }
// <summary> // REQUIRES:: entity is not null and MergeOption is OverwriteChanges or PreserveChanges // Calls through to HandleEntity after retrieving the EntityKey from the given entity. // Still need this so that the correct key will be used for iPOCOs that implement IEntityWithKey // in a non-default manner. // </summary> public IEntityWrapper HandleIEntityWithKey <TEntity>(IEntityWrapper wrappedEntity, EntitySet entitySet) { DebugCheck.NotNull(wrappedEntity); return(HandleEntity <TEntity>(wrappedEntity, wrappedEntity.EntityKey, entitySet)); }
public static object GetConfiguration(this EntityType entityType) { DebugCheck.NotNull(entityType); return(entityType.Annotations.GetConfiguration()); }
private void UpdateEntry <TEntity>(IEntityWrapper wrappedEntity, EntityEntry existingEntry) { DebugCheck.NotNull(wrappedEntity); DebugCheck.NotNull(wrappedEntity.Entity); DebugCheck.NotNull(existingEntry); DebugCheck.NotNull(existingEntry.Entity); var clrType = typeof(TEntity); if (clrType != existingEntry.WrappedEntity.IdentityType) { var key = existingEntry.EntityKey; throw new NotSupportedException( Strings.Materializer_RecyclingEntity( TypeHelpers.GetFullName(key.EntityContainerName, key.EntitySetName), clrType.FullName, existingEntry.WrappedEntity.IdentityType.FullName)); } if (EntityState.Added == existingEntry.State) { throw new InvalidOperationException(Strings.Materializer_AddedEntityAlreadyExists(clrType.FullName)); } if (MergeOption.AppendOnly != MergeOption) { // existing entity, update CSpace values in place Debug.Assert(EntityState.Added != existingEntry.State, "entry in State=Added"); Debug.Assert(EntityState.Detached != existingEntry.State, "entry in State=Detached"); if (MergeOption.OverwriteChanges == MergeOption) { if (EntityState.Deleted == existingEntry.State) { existingEntry.RevertDelete(); } existingEntry.UpdateCurrentValueRecord(wrappedEntity.Entity); Context.ObjectStateManager.ForgetEntryWithConceptualNull(existingEntry, resetAllKeys: true); existingEntry.AcceptChanges(); Context.ObjectStateManager.FixupReferencesByForeignKeys(existingEntry, replaceAddedRefs: true); } else { Debug.Assert(MergeOption.PreserveChanges == MergeOption, "not MergeOption.PreserveChanges"); if (EntityState.Unchanged == existingEntry.State) { // same behavior as MergeOption.OverwriteChanges existingEntry.UpdateCurrentValueRecord(wrappedEntity.Entity); Context.ObjectStateManager.ForgetEntryWithConceptualNull(existingEntry, resetAllKeys: true); existingEntry.AcceptChanges(); Context.ObjectStateManager.FixupReferencesByForeignKeys(existingEntry, replaceAddedRefs: true); } else { if (Context.ContextOptions.UseLegacyPreserveChangesBehavior) { // Do not mark properties as modified if they differ from the entity. existingEntry.UpdateRecordWithoutSetModified(wrappedEntity.Entity, existingEntry.EditableOriginalValues); } else { // Mark properties as modified if they differ from the entity existingEntry.UpdateRecordWithSetModified(wrappedEntity.Entity, existingEntry.EditableOriginalValues); } } } } }
public static IEnumerable <EdmProperty> GetDeclaredPrimitiveProperties(this EntityType entityType) { DebugCheck.NotNull(entityType); return(entityType.DeclaredProperties.Where(p => p.IsUnderlyingPrimitiveType)); }
internal EntityMappingConfiguration(EntityMappingConfiguration entityMappingConfiguration) { DebugCheck.NotNull(entityMappingConfiguration); _entityMappingConfiguration = entityMappingConfiguration; }
public static EntityType GetKeyNamesType(this EntityType table) { DebugCheck.NotNull(table); return((EntityType)table.Annotations.GetAnnotation(KeyNamesTypeAnnotation)); }
internal virtual void OnSeed(DbContext context) { DebugCheck.NotNull(context); }
// <summary> // Entry point for Type specific generation of Query Views // </summary> internal static ViewGenResults GenerateTypeSpecificQueryView( EntityContainerMapping containerMapping, ConfigViewGenerator config, EntitySetBase entity, EntityTypeBase type, bool includeSubtypes, out bool success) { DebugCheck.NotNull(containerMapping); DebugCheck.NotNull(config); DebugCheck.NotNull(entity); DebugCheck.NotNull(type); Debug.Assert(!type.Abstract, "Can not generate OfType/OfTypeOnly query view for and abstract type"); if (config.IsNormalTracing) { Helpers.StringTraceLine(""); Helpers.StringTraceLine( "<<<<<<<< Generating Query View for Entity [" + entity.Name + "] OfType" + (includeSubtypes ? "" : "Only") + "(" + type.Name + ") >>>>>>>"); } if (containerMapping.GetEntitySetMapping(entity.Name).QueryView != null) { //Type-specific QV does not exist in the cache, but // there is a EntitySet QV. So we can't generate the view (no mapping exists for this EntitySet) // and we rely on Query to call us again to get the EntitySet View. success = false; return(null); } //Compute Cell Groups or get it from Memoizer var args = new InputForComputingCellGroups(containerMapping, config); var result = containerMapping.GetCellgroups(args); success = result.Success; if (!success) { return(null); } var foreignKeyConstraints = result.ForeignKeyConstraints; // Get a Clone of cell groups from cache since cells are modified during viewgen, and we dont want the cached copy to change var cellGroups = result.CellGroups.Select(setOfcells => new CellGroup(setOfcells.Select(cell => new Cell(cell)))).ToList(); var cells = result.Cells; var identifiers = result.Identifiers; var viewGenResults = new ViewGenResults(); var tmpLog = EnsureAllCSpaceContainerSetsAreMapped(cells, containerMapping); if (tmpLog.Count > 0) { viewGenResults.AddErrors(tmpLog); Helpers.StringTraceLine(viewGenResults.ErrorsToString()); success = true; //atleast we tried successfully return(viewGenResults); } foreach (var cellGroup in cellGroups) { if (!DoesCellGroupContainEntitySet(cellGroup, entity)) { continue; } ViewGenerator viewGenerator = null; var groupErrorLog = new ErrorLog(); try { viewGenerator = new ViewGenerator(cellGroup, config, foreignKeyConstraints, containerMapping); } catch (InternalMappingException exception) { // All exceptions have mapping errors in them Debug.Assert(exception.ErrorLog.Count > 0, "Incorrectly created mapping exception"); groupErrorLog = exception.ErrorLog; } if (groupErrorLog.Count > 0) { break; } Debug.Assert(viewGenerator != null); //make sure there is no exception thrown that does not add error to log var mode = includeSubtypes ? ViewGenMode.OfTypeViews : ViewGenMode.OfTypeOnlyViews; groupErrorLog = viewGenerator.GenerateQueryViewForSingleExtent(viewGenResults.Views, identifiers, entity, type, mode); if (groupErrorLog.Count != 0) { viewGenResults.AddErrors(groupErrorLog); } } success = true; return(viewGenResults); }
public StateEntryAdapter(ObjectStateEntry stateEntry) { DebugCheck.NotNull(stateEntry); _stateEntry = stateEntry; }
internal ProjectionNewMetadata(NewExpression newExpression) : base(newExpression.Type) { DebugCheck.NotNull(newExpression); _newExpression = newExpression; }
public MigrationsConfigurationFinder(TypeFinder typeFinder) { DebugCheck.NotNull(typeFinder); _typeFinder = typeFinder; }
internal ProjectionInitializerMetadata(MemberInitExpression initExpression) : base(initExpression.Type) { DebugCheck.NotNull(initExpression); _initExpression = initExpression; }
// <summary> // Creates literal token // </summary> // <param name="literal"> literal </param> // <param name="literalKind"> literal kind </param> // <returns> Literal Token </returns> internal Token NewLiteralToken(string literal, LiteralKind literalKind) { DebugCheck.NotEmpty(literal); Debug.Assert(literalKind != LiteralKind.Null, "literalKind must not be LiteralKind.Null"); var literalValue = literal; switch (literalKind) { case LiteralKind.Binary: literalValue = GetLiteralSingleQuotePayload(literal); if (!IsValidBinaryValue(literalValue)) { var errorMessage = Strings.InvalidLiteralFormat("binary", literalValue); throw EntitySqlException.Create(_query, errorMessage, _iPos, null, false, null); } break; case LiteralKind.String: if ('N' == literal[0]) { literalKind = LiteralKind.UnicodeString; } break; case LiteralKind.DateTime: literalValue = GetLiteralSingleQuotePayload(literal); if (!IsValidDateTimeValue(literalValue)) { var errorMessage = Strings.InvalidLiteralFormat("datetime", literalValue); throw EntitySqlException.Create(_query, errorMessage, _iPos, null, false, null); } break; case LiteralKind.Time: literalValue = GetLiteralSingleQuotePayload(literal); if (!IsValidTimeValue(literalValue)) { var errorMessage = Strings.InvalidLiteralFormat("time", literalValue); throw EntitySqlException.Create(_query, errorMessage, _iPos, null, false, null); } break; case LiteralKind.DateTimeOffset: literalValue = GetLiteralSingleQuotePayload(literal); if (!IsValidDateTimeOffsetValue(literalValue)) { var errorMessage = Strings.InvalidLiteralFormat("datetimeoffset", literalValue); throw EntitySqlException.Create(_query, errorMessage, _iPos, null, false, null); } break; case LiteralKind.Guid: literalValue = GetLiteralSingleQuotePayload(literal); if (!IsValidGuidValue(literalValue)) { var errorMessage = Strings.InvalidLiteralFormat("guid", literalValue); throw EntitySqlException.Create(_query, errorMessage, _iPos, null, false, null); } break; } return(NewToken(CqlParser.LITERAL, new Literal(literalValue, literalKind, _query, _iPos))); }
internal PropertyConventionConfiguration(ConventionsConfiguration conventionsConfiguration) : this(conventionsConfiguration, Enumerable.Empty <Func <PropertyInfo, bool> >()) { DebugCheck.NotNull(conventionsConfiguration); }
internal virtual void Configure(EdmProperty column, FacetDescription facetDescription) { DebugCheck.NotNull(column); DebugCheck.NotNull(facetDescription); }