Print Page | Close Window

EdmFunctionAttribute not working in WPF

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2012
Forum Discription: For .NET 4.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3898
Printed Date: 23-May-2024 at 4:02pm


Topic: EdmFunctionAttribute not working in WPF
Posted By: mseeli
Subject: EdmFunctionAttribute not working in WPF
Date Posted: 17-Jan-2013 at 3:32am
We are currently converting a Silerlight application into WPF.
We have some server side sqlfunctions defined.

        [EdmFunction("VIS6Model.Store""CacheField")]
        public static string CacheField(string s1, int i1)
        {
            throw new NotSupportedException("This function can only be used in a LINQ to Entities query");
        }
the usage looks like this:
      IEntityQuery<MasterEntityDb> enq = VisContext.VisRepository.Manager.GetQuery<MasterEntityDb>();
      enq = enq.OrderByDescending(x => MySqlLinqFunctions.CacheField(x.Cache, SortFieldIdx));
      var searchQuery = enq.Where(SearchPredicate).Take(PageSize);
      var results = (await VisContext.VisRepository.Manager.ExecuteQueryAsync(searchQuery)).ToList();

(VisContext.VisRepository.Manager is the DevForce Entity Manager)
It works fine in Silverlight but when we run in on the WPF Client we get the NotSupportedException from above.
Is this an known issue?





Replies:
Posted By: kimj
Date Posted: 17-Jan-2013 at 3:22pm
EdmFunctions such as this are still supported.  These functions can be used only with the DataSourceOnly QueryStrategy, since the query cannot be run against cache.  When it is run against cache you'll see that exception hit, since the C# method is being called.



Print Page | Close Window