EntityFramework.Functions library implements Entity Framework code first support for stored procedures (with single result type, multiple result types, output parameter), table-valued functions (returning entity type, complex type), scalar-valued functions (composable, non-composable), aggregate functions, built-in functions, niladic functions, and model defined functions.
*/
[ModelDefinedFunction(nameof(ParseDouble), "EntityFramework.Functions.Tests.Examples", @"cast(svalue as Edm.Double)")]
public static double ParseDouble(this string svalue) => double.Parse(svalue);
`
Test Name: ModelDefinedFunctionInLinqTest2
Test FullName: EntityFramework.Functions.Tests.UnitTests.AdventureWorksTests.ModelDefinedFunctionInLinqTest2
Test Source: d:\projects\EntityFramework.Functions\EntityFramework.Functions.Tests\UnitTests\FunctionTests.cs : line 241
Test Outcome: Failed
Test Duration: 0:00:00.8249291
Result StackTrace:
at EntityFramework.Functions.Function.GetModelStructualType(DbModel model, Type clrType, MethodInfo methodInfo) in d:\projects\EntityFramework.Functions\EntityFramework.Functions\Function.DbModel.cs:line 720
at EntityFramework.Functions.Function.<>cDisplayClass10_0.b0(ParameterInfo parameterInfo) in d:\projects\EntityFramework.Functions\EntityFramework.Functions\Function.DbModel.cs:line 561
at System.Linq.Enumerable.WhereSelectArrayIterator2.MoveNext() at System.Linq.Buffer1..ctor(IEnumerable1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source)
at EntityFramework.Functions.Function.GetModelParametersForModelDefinedFunction(DbModel model, MethodInfo methodInfo) in d:\projects\EntityFramework.Functions\EntityFramework.Functions\Function.DbModel.cs:line 560
at EntityFramework.Functions.Function.AddModelDefinedFunction(DbModel model, MethodInfo methodInfo, ModelDefinedFunctionAttribute functionAttribute) in d:\projects\EntityFramework.Functions\EntityFramework.Functions\Function.DbModel.cs:line 283
at EntityFramework.Functions.Function.AddFunction(DbModel model, MethodInfo methodInfo, FunctionAttribute functionAttribute) in d:\projects\EntityFramework.Functions\EntityFramework.Functions\Function.DbModel.cs:line 62
at EntityFramework.Functions.Function.<>cDisplayClass1_0.b2(<>f__AnonymousType02 method) in d:\projects\EntityFramework.Functions\EntityFramework.Functions\Function.DbModel.cs:line 37 at EntityFramework.Functions.EnumerableExtensions.ForEach[TSource](IEnumerable1 source, Action1 next) in d:\projects\EntityFramework.Functions\EntityFramework.Functions\Utilities.cs:line 21 at EntityFramework.Functions.Function.AddFunctions(DbModel model, Type functionsType) in d:\projects\EntityFramework.Functions\EntityFramework.Functions\Function.DbModel.cs:line 28 at EntityFramework.Functions.EnumerableExtensions.ForEach[TSource](IEnumerable1 source, Action1 next) in d:\projects\EntityFramework.Functions\EntityFramework.Functions\Utilities.cs:line 21 at EntityFramework.Functions.FunctionConvention.Apply(EntityContainer item, DbModel model) in d:\projects\EntityFramework.Functions\EntityFramework.Functions\FunctionConvention.cs:line 25 at System.Data.Entity.ModelConfiguration.Configuration.ConventionsConfiguration.ModelConventionDispatcher.Dispatch[T](T item) at System.Data.Entity.ModelConfiguration.Configuration.ConventionsConfiguration.ModelConventionDispatcher.VisitEdmEntityContainer(EntityContainer item) at System.Data.Entity.Edm.EdmModelVisitor.VisitCollection[T](IEnumerable1 collection, Action1 visitMethod) at System.Data.Entity.Edm.EdmModelVisitor.VisitEntityContainers(IEnumerable1 entityContainers)
at System.Data.Entity.Edm.EdmModelVisitor.VisitEdmModel(EdmModel item)
at System.Data.Entity.ModelConfiguration.Configuration.ConventionsConfiguration.ModelConventionDispatcher.VisitEdmModel(EdmModel item)
at System.Data.Entity.ModelConfiguration.Configuration.ConventionsConfiguration.ModelConventionDispatcher.Dispatch()
at System.Data.Entity.ModelConfiguration.Configuration.ConventionsConfiguration.ApplyStoreModel(DbModel model)
at System.Data.Entity.DbModelBuilder.Build(DbProviderManifest providerManifest, DbProviderInfo providerInfo)
at System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)
at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
at System.Data.Entity.Internal.RetryLazy2.GetValue(TInput input) at System.Data.Entity.Internal.LazyInternalContext.InitializeContext() at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) at System.Data.Entity.Internal.Linq.InternalSet1.Initialize()
at System.Data.Entity.Internal.Linq.InternalSet1.get_InternalContext() at System.Data.Entity.Infrastructure.DbQuery1.System.Linq.IQueryable.get_Provider()
at System.Linq.Queryable.SelectTSource,TResult
at EntityFramework.Functions.Tests.UnitTests.AdventureWorksTests.ModelDefinedFunctionInLinqTest2() in d:\projects\EntityFramework.Functions\EntityFramework.Functions.Tests\UnitTests\FunctionTests.cs:line 244
Result Message:
Test method EntityFramework.Functions.Tests.UnitTests.AdventureWorksTests.ModelDefinedFunctionInLinqTest2 threw exception:
System.NotSupportedException: System.String for method ParseDouble is not supported in conceptual model as a structural type.
` /*
`
Test Name: ModelDefinedFunctionInLinqTest2 Test FullName: EntityFramework.Functions.Tests.UnitTests.AdventureWorksTests.ModelDefinedFunctionInLinqTest2 Test Source: d:\projects\EntityFramework.Functions\EntityFramework.Functions.Tests\UnitTests\FunctionTests.cs : line 241 Test Outcome: Failed Test Duration: 0:00:00.8249291
Result StackTrace:
at EntityFramework.Functions.Function.GetModelStructualType(DbModel model, Type clrType, MethodInfo methodInfo) in d:\projects\EntityFramework.Functions\EntityFramework.Functions\Function.DbModel.cs:line 720 at EntityFramework.Functions.Function.<>cDisplayClass10_0.b0(ParameterInfo parameterInfo) in d:\projects\EntityFramework.Functions\EntityFramework.Functions\Function.DbModel.cs:line 561 at System.Linq.Enumerable.WhereSelectArrayIterator2.MoveNext() at System.Linq.Buffer1..ctor(IEnumerable1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source) at EntityFramework.Functions.Function.GetModelParametersForModelDefinedFunction(DbModel model, MethodInfo methodInfo) in d:\projects\EntityFramework.Functions\EntityFramework.Functions\Function.DbModel.cs:line 560 at EntityFramework.Functions.Function.AddModelDefinedFunction(DbModel model, MethodInfo methodInfo, ModelDefinedFunctionAttribute functionAttribute) in d:\projects\EntityFramework.Functions\EntityFramework.Functions\Function.DbModel.cs:line 283 at EntityFramework.Functions.Function.AddFunction(DbModel model, MethodInfo methodInfo, FunctionAttribute functionAttribute) in d:\projects\EntityFramework.Functions\EntityFramework.Functions\Function.DbModel.cs:line 62 at EntityFramework.Functions.Function.<>cDisplayClass1_0.b2(<>f__AnonymousType02 method) in d:\projects\EntityFramework.Functions\EntityFramework.Functions\Function.DbModel.cs:line 37 at EntityFramework.Functions.EnumerableExtensions.ForEach[TSource](IEnumerable1 source, Action1 next) in d:\projects\EntityFramework.Functions\EntityFramework.Functions\Utilities.cs:line 21 at EntityFramework.Functions.Function.AddFunctions(DbModel model, Type functionsType) in d:\projects\EntityFramework.Functions\EntityFramework.Functions\Function.DbModel.cs:line 28 at EntityFramework.Functions.EnumerableExtensions.ForEach[TSource](IEnumerable1 source, Action1 next) in d:\projects\EntityFramework.Functions\EntityFramework.Functions\Utilities.cs:line 21 at EntityFramework.Functions.FunctionConvention.Apply(EntityContainer item, DbModel model) in d:\projects\EntityFramework.Functions\EntityFramework.Functions\FunctionConvention.cs:line 25 at System.Data.Entity.ModelConfiguration.Configuration.ConventionsConfiguration.ModelConventionDispatcher.Dispatch[T](T item) at System.Data.Entity.ModelConfiguration.Configuration.ConventionsConfiguration.ModelConventionDispatcher.VisitEdmEntityContainer(EntityContainer item) at System.Data.Entity.Edm.EdmModelVisitor.VisitCollection[T](IEnumerable1 collection, Action1 visitMethod) at System.Data.Entity.Edm.EdmModelVisitor.VisitEntityContainers(IEnumerable1 entityContainers) at System.Data.Entity.Edm.EdmModelVisitor.VisitEdmModel(EdmModel item) at System.Data.Entity.ModelConfiguration.Configuration.ConventionsConfiguration.ModelConventionDispatcher.VisitEdmModel(EdmModel item) at System.Data.Entity.ModelConfiguration.Configuration.ConventionsConfiguration.ModelConventionDispatcher.Dispatch() at System.Data.Entity.ModelConfiguration.Configuration.ConventionsConfiguration.ApplyStoreModel(DbModel model) at System.Data.Entity.DbModelBuilder.Build(DbProviderManifest providerManifest, DbProviderInfo providerInfo) at System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) at System.Data.Entity.Internal.RetryLazy2.GetValue(TInput input) at System.Data.Entity.Internal.LazyInternalContext.InitializeContext() at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) at System.Data.Entity.Internal.Linq.InternalSet1.Initialize() at System.Data.Entity.Internal.Linq.InternalSet1.get_InternalContext() at System.Data.Entity.Infrastructure.DbQuery1.System.Linq.IQueryable.get_Provider() at System.Linq.Queryable.SelectTSource,TResult at EntityFramework.Functions.Tests.UnitTests.AdventureWorksTests.ModelDefinedFunctionInLinqTest2() in d:\projects\EntityFramework.Functions\EntityFramework.Functions.Tests\UnitTests\FunctionTests.cs:line 244 Result Message: Test method EntityFramework.Functions.Tests.UnitTests.AdventureWorksTests.ModelDefinedFunctionInLinqTest2 threw exception: System.NotSupportedException: System.String for method ParseDouble is not supported in conceptual model as a structural type.