New Posts New Posts RSS Feed: EdmFunctionAttribute not working in WPF
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

EdmFunctionAttribute not working in WPF

 Post Reply Post Reply
Author
mseeli View Drop Down
Newbie
Newbie
Avatar

Joined: 20-Sep-2010
Location: Switzerland
Posts: 31
Post Options Post Options   Quote mseeli Quote  Post ReplyReply Direct Link To This Post Topic: EdmFunctionAttribute not working in WPF
    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?




Edited by mseeli - 17-Jan-2013 at 3:35am
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down