Friday, 15 February 2013

c# - How can I get rid of the "Obsolete" attribute warning after upgrading to EF6? -


I got a warning after upgrading the database "adfunction attribute is obsolete" EF4 to EF 6.1.3:

'System.Data.Entity.Core.Objects.DataClasses.EdmFunctionAttribute' is obsolete: 'This feature has been replaced by the system .Data.Entity .DbFunctionAttribute. 'C: \ {myProjectPath} \ DataContextEntityObjects.cs

The file is generated from the file DataContextEntityObjects.cs DataContextEntityObjects.tt and Uses various properties such as

  [Adam Function ("Datacontext", "Split")] Public IQueryable & lt; Split_Result & gt; Split (Global :: System.String rowData, global :: system.String splitOn) {// ... auto-generated code ...}  

Since it is automatic -Unconfirmed How can I get rid of this warning permanently when I update the model from the database ?


Note: A warning has occurred right after I have it.

In my case, the solution was to modify the T4 template as follows:

I Identified that the relevant portion of the T4 file starts here (line 214-283):

  //// //// //////// Entity Container and Object Write a contact function, import import methods //////// fields Previous (Code GenerationTool.GetRSOSstring ("Template_Planning Functions Imports")); Forrest (Adfunction Amp Function in Container) Functions Imports) {IEnumerable & lt; FunctionImportParameter & gt; Parameter = functionimportportemater Create (edmFunction.Parameters, code, ef); As suggested in the template, and the template can be modified to generate the correct code.  

Do the following:

  1. Open DataContextEntityObjects.tt file
  2. Search and replace:

    AdamFunction Replacement

  3. < / Ol>

    related to it *. CC will generate the file, change the attribute and remove obsolete warnings.


No comments:

Post a Comment