public void EntityFrameworkDataServiceProviderBehavior() { ObjectContextServiceProvider objContextProvider = new ObjectContextServiceProvider(new object(), new object()); IDataServiceProviderBehavior providerBehavior = objContextProvider as IDataServiceProviderBehavior; Assert.IsTrue(providerBehavior.ProviderBehavior.ProviderQueryBehavior == ProviderQueryBehaviorKind.EntityFrameworkProviderQueryBehavior); }
internal IList <ResourceProperty> GetETagProperties(string containerName, ResourceType resourceType) { ObjectContextServiceProvider metadataProvider = this.metadataProvider as ObjectContextServiceProvider; if (metadataProvider != null) { return(metadataProvider.GetETagProperties(containerName, resourceType)); } return(resourceType.ETagProperties); }
internal IEnumerable <KeyValuePair <string, object> > GetEntityContainerAnnotations(string entityContainerName) { ObjectContextServiceProvider metadataProvider = this.metadataProvider as ObjectContextServiceProvider; if (metadataProvider != null) { return(metadataProvider.GetEntityContainerAnnotations(entityContainerName)); } return(WebUtil.EmptyKeyValuePairStringObject); }
internal MetadataEdmSchemaVersion GetMetadataEdmSchemaVersion(DataServiceOperationContext operationContext) { this.GetMetadataVersion(operationContext); ObjectContextServiceProvider metadataProvider = this.metadataProvider as ObjectContextServiceProvider; if (metadataProvider != null) { this.edmSchemaVersion = WebUtil.RaiseMetadataEdmSchemaVersion(this.edmSchemaVersion, metadataProvider.EdmSchemaVersion); } return(this.edmSchemaVersion); }
public void VerifyPopulateMemberMetadataFailsOnEnumPropertyOnEntityType() { Type entityClrType = typeof(TestEntityTypeWithEnum); Type[] primitiveTypes = new Type[] { typeof(string) }; PrimitiveResourceTypeMap typeMap; ResourceType entityResourceType; ProviderMetadataSimulator workspace; SetupTestMetadata(entityClrType, primitiveTypes, out entityResourceType, out workspace, out typeMap); Action test = () => ObjectContextServiceProvider.PopulateMemberMetadata(new ResourceTypeCacheItem(entityResourceType), workspace, null, typeMap); test.ShouldThrow <NotSupportedException>().WithMessage(Strings.ObjectContext_PrimitiveTypeNotSupported("EnumProperty", entityClrType.Name, ProviderMemberSimulator.GetEdmTypeName(typeof(Enum)))); }
public void VerifyPopulateMemberMetadataReturnsValidResourceProperties() { Type entityClrType = typeof(TestEntityType); Type[] primitiveTypes = entityClrType.GetProperties().Select(p => p.PropertyType).ToArray(); PrimitiveResourceTypeMap typeMap; ResourceType entityResourceType; ProviderMetadataSimulator workspace; SetupTestMetadata(entityClrType, primitiveTypes, out entityResourceType, out workspace, out typeMap); ObjectContextServiceProvider.PopulateMemberMetadata(new ResourceTypeCacheItem(entityResourceType), workspace, null, typeMap); VerifyResourceProperties(entityClrType, entityResourceType); }
/// <summary> /// Disposes the current object. /// </summary> /// <param name="disposing">Whethere the call is coming from IDisposable interface.</param> protected virtual void Dispose(bool disposing) { if (disposing) { try { if (this.innerProvider != null) { (this.innerProvider as IDisposable).Dispose(); } } finally { this.innerProvider = null; } } }
/// <summary> /// Creates the inner provider object. /// </summary> /// <param name="dataServiceInstance">Data service instance.</param> /// <param name="dataSourceInstance">Data source instance.</param> private void CreateInnerProvider(object dataServiceInstance, object dataSourceInstance) { Debug.Assert(dataServiceInstance != null, "dataServiceInstance != null"); Debug.Assert(dataSourceInstance != null, "dataSourceInstance != null"); this.innerProvider = new ObjectContextServiceProvider(dataServiceInstance, dataSourceInstance); }
public Type GetClrType(StructuralType structuralType) { return(ObjectContextServiceProvider.GetClrTypeForCSpaceType(this.metadataWorkspace, structuralType)); }