score:0
here's are the modifications that got it working for me.
in the onmodelcreating() method, add this line:
protected override void onmodelcreating(dbmodelbuilder modelbuilder)
{
// ...
modelbuilder.conventions.add(new functionsconvention("dbo", this.gettype()));
}
when defining the dbfunction stub use these attributes:
[dbfunction("codefirstdatabaseschema", "echo")]
public static string echo(string text)
{
throw new notsupportedexception("direct calls are not supported.");
}
i took ideas from this link
here's the test i performed to see if it was the issue you were having: if i comment out the modelbuilder.conventions.add line above, i receive a similar error to what you were receiving.
system.notsupportedexception: 'the specified method 'system.string echo(system.string)' on the type 'try1.excontext' cannot be translated into a linq to entities store expression.'
Source: stackoverflow.com
Related Query
- LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression
- LINQ to Entities does not recognize the method 'Int32 Int32(System.String)' method, and this method cannot be translated into a store expression
- LINQ to Entities does not recognize the method 'Int32 ToInt32(System.Object)' method, and this method cannot be translated into a store expression
- LINQ to Entities does not recognize the method 'Int32 Parse(System.String)' method, and this method cannot be translated into a store expression
- LINQ to Entities does not recognize the method 'Int32 ToInt32(System.String)' method, and this method cannot be translated into a store expression
- LINQ to Entities does not recognize the method 'System.String ToString(Int32)' method, and this method cannot be translated into a store expression
- LINQ to Entities does not recognize the method 'Double ToDouble(System.String)' method, and this method cannot be translated into a store expression
- LINQ to Entities does not recognize the method and this method cannot be translated into a store expression
- LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression
- LINQ to Entities does not recognize the method 'Double Parse(System.String)' cannot be translated into a store expression C# asp.net
- LINQ to Entities does not recognize the method, and this method cannot be translated into a store expression
- LINQ to Entities does not recognize the method 'System.String ToString()' method and this method cannot be translated into a store expression
- LINQ to Entities does not recognize the method 'System.String get_Item(Int32)' method, and this method cannot be translated into a store expression
- LINQ to Entities does not recognize the method 'System.DateTime GetDate()' method, and this method cannot be translated into a store expression
- LINQ to Entities - method cannot be translated into a store expression
- LINQ to Entities does not recognize the method 'System.String get_Item(Int32)' method, and this method cannot be translated into a store expression
- LINQ to Entities does not recognize the method ..., and this method cannot be translated into a store expression
- Additional information: LINQ to Entities does not recognize the method and this method cannot be translated into a store expression
- LINQ to Entities does not recognize the method 'System.String ToString()' method,and this method cannot be translated into a store expression
- LINQ to Entities does not recognize the method 'Char get_Chars(Int32)' method, and this method cannot be translated into a store expression
- LINQ to Entities does not recognize the method 'Single ToSingle(System.String)' method, and this method cannot be translated into a store expression
- Converting linq select into model, LINQ to Entities does not recognize the method, and this method cannot be translated into a store expression
- LINQ to Entities does not recognize the method,and this method cannot be translated into a store expression
- Error LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression
- LINQ to Entities does not recognize the method, Method cannot be translated into a store expression
- LINQ to Entities does not recognize the method Urls.MeaningfulURL, and this method cannot be translated into a store expression
- LINQ to Entities does not recognize the method 'Boolean HasFlag(System.Enum)' method, and this method cannot be translated into a store expression
- DbFunction "cannot be translated into a LINQ to Entities store expression"
- Linq to Entities "does not recognize the method ... method, and this method cannot be translated into a store expression."
- Method cannot be translated into a store expression in LINQ
More Query from same tag
- How to get input value of dynamically added textboxes
- Prevent new values from LINQ query
- Using LINQ to select desired results between two related IEnumerable query objects
- How to filter data from datatable according to columns suffix
- How to return substring of linq results
- DateDiff equivalent in Linq MVC
- Empty data on List in LinQ Statement
- Convert a datatable to IList c#
- LINQ to Entiites, left outer join of a group by
- query cannot be enumerated more than once
- How to optmize linq query for grouping dates by price without merging results
- linq query for sql xml column
- Concat all strings inside a List<string> using LINQ
- Handling LINQ Concurrency Issues?
- Tricky LINQ and nested collection
- Filling class object from multiple dataset
- Combining items in a given datatable column using LINQ
- Initialize var to null
- Searching a tables XML filed using Linq, can it be done?
- Creating a LINQ query based on two Lists and object array for testing parameters
- Select Single Parent with Multiple Children into Custom Entity
- Trying to find alternative way to express LINQ expression
- Build Dynamic Expression For Linq Where using PropertyInfo and a value
- Distinct with encapsulated equality
- Sum and grouping multiple columns into one value in linq
- How to store a Linq query and use it later?
- Selecting Consecutive Entries with LINQ to Entities
- How to find the last item from list have the same item using linq
- Extracting only certain indexes
- Create where clause with column name only known at runtime