public static EdmModel BuildEdmModel(this OeDataAdapter dataAdapter) { var modelBuilder = new OeEdmModelBuilder(dataAdapter.EntitySetMetaAdapters.EdmModelMetadataProvider, dataAdapter.EntitySetMetaAdapters.ToDictionary()); BuildOperations(dataAdapter, modelBuilder); return(modelBuilder.BuildEdmModel()); }
public static EdmModel BuildEdmModel(this Db.OeDataAdapter dataAdapter) { var modelBuilder = new OeEdmModelBuilder(dataAdapter.EntitySetMetaAdapters.EdmModelMetadataProvider); modelBuilder.AddEntitySetRange(dataAdapter.EntitySetMetaAdapters.GetEntitySetNamesEntityTypes()); BuildOperations(dataAdapter, modelBuilder); return(modelBuilder.BuildEdmModel()); }
public static Db.OeDataAdapter GetDataAdapter(this IEdmModel edmModel, IEdmEntityContainer entityContainer) { Db.OeDataAdapter dataAdapter = edmModel.GetAnnotationValue <Db.OeDataAdapter>(entityContainer); if (dataAdapter == null) { dataAdapter = edmModel.GetEdmModel(entityContainer).GetAnnotationValue <Db.OeDataAdapter>(entityContainer); } return(dataAdapter); }
public static void BuildOperations(Db.OeDataAdapter dataAdapter, OeEdmModelBuilder modelBuilder) { OeOperationConfiguration[] operations = dataAdapter.OperationAdapter.GetOperations(); if (operations != null) { foreach (OeOperationConfiguration operation in operations) { modelBuilder.AddOperation(operation); } } }
public static Db.OeDataAdapter GetDataAdapter(this IEdmModel edmModel, IEdmEntityContainer entityContainer) { Db.OeDataAdapter dataAdapter = edmModel.GetAnnotationValue <Db.OeDataAdapter>(entityContainer); if (dataAdapter == null) { dataAdapter = edmModel.GetEdmModel(entityContainer).GetAnnotationValue <Db.OeDataAdapter>(entityContainer); } if (dataAdapter == null) { throw new InvalidOperationException("OeDataAdapter not found in EdmModel"); } return(dataAdapter); }
public static Db.OeDataAdapter GetDataAdapter(this IEdmModel edmModel, Type dataContextType) { Db.OeDataAdapter dataAdapter = edmModel.GetAnnotationValue <Db.OeDataAdapter>(edmModel.EntityContainer); if (dataAdapter.DataContextType == dataContextType) { return(dataAdapter); } foreach (IEdmModel refModel in edmModel.ReferencedModels) { if (refModel.EntityContainer != null) { return(refModel.GetDataAdapter(dataContextType)); } } throw new InvalidOperationException("OeDataAdapter not found for data context type " + dataContextType.FullName); }
private static void BuildOperations(OeDataAdapter dataAdapter, OeEdmModelBuilder modelBuilder) { MethodInfo[] operations = dataAdapter.GetOperations(); if (operations != null) { foreach (MethodInfo methodInfo in operations) { var description = (DescriptionAttribute)methodInfo.GetCustomAttribute(typeof(DescriptionAttribute)); String name = description == null ? methodInfo.Name : description.Description; OeOperationConfiguration functionConfiguration = modelBuilder.AddFunction(null, name); foreach (ParameterInfo parameterInfo in methodInfo.GetParameters()) { functionConfiguration.AddParameter(parameterInfo.Name, parameterInfo.ParameterType); } functionConfiguration.ReturnType = methodInfo.ReturnType; } } }
public OeGetParser(Db.OeDataAdapter dataAdapter, IEdmModel model) { _dataAdapter = dataAdapter; _edmModel = model; }
public static void SetDataAdapter(this IEdmModel edmModel, EdmEntityContainer entityContainer, Db.OeDataAdapter dataAdapter) { edmModel.SetAnnotationValue(entityContainer, dataAdapter); }
public OeParser(Uri baseUri, Db.OeDataAdapter dataAdapter, IEdmModel model) { _baseUri = baseUri; _dataAdapter = dataAdapter; _model = model; }
public OeEntitySetAdapter(OeEntitySetMetaAdapter entitySetMetaAdapter, OeDataAdapter dataAdapter) { _entitySetMetaAdapter = entitySetMetaAdapter; _dataAdapter = dataAdapter; }
public OeParser(Uri baseUri, Db.OeDataAdapter dataAdapter, IEdmModel edmModel) : this(baseUri, edmModel) { }
public static EdmModel BuildEdmModel(this Db.OeDataAdapter dataAdapter, Type[] excludedTypes, params IEdmModel[] refModels) { var modelBuilder = new OeEdmModelBuilder(dataAdapter, new OeEdmModelMetadataProvider()); return(modelBuilder.BuildEdmModel(excludedTypes, refModels)); }
public OePostParser(Db.OeDataAdapter dataAdapter, IEdmModel edmModel) { _dataAdapter = dataAdapter; _edmModel = edmModel; }