开发者

Error with Invoke method in a domainservice class

开发者 https://www.devze.com 2023-02-07 13:59 出处:网络
i\'m new with silverlight/ria and i have a problem wath i don\'t understand. I have the following code in my domain services class

i'm new with silverlight/ria and i have a problem wath i don't understand.

I have the following code in my domain services class

[EnableClientAccess()]
[KnownType(typeof(ModeleEmailEa))]
[KnownType(typeof(ModeleSmsEa))]
public class EAEMailDomainService : DomainService
{       

    #region ModeleEnvoiEa CRUD

    [Query()]
    public IQueryable<ModeleEnvoiEa> SelectAllModeleEnvoiEa()
    {
        ModeleEnvoiEaSrv modeleService = new ModeleEnvoiEaSrv();
        return modeleService.GetList<ModeleEnvoiEa>();

    }

    [Update]
    public void UpdateModeleEnvoiEa(ModeleEnvoiEa modele)
    {
        ModeleEnvoiEaSrv modeleService = new ModeleEnvoiEaSrv();
        modeleService.Update(modele);            
    }

    [Insert]
    public void InsertModeleEnvoiEa(ModeleEnvoiEa modele)
    {
        ModeleEnvoiEaSrv modeleService = new ModeleEnvoiEaSrv();
        modeleService.Insert(modele);
    }

    [Delete]
    public void DeleteModeleEnvoiEa(ModeleEnvoiEa modele)
    {
        ModeleEnvoiEaSrv modeleService = new ModeleEnvoiEaSrv();
        modeleService.Delete(modele);
    }       

    [Invoke]
    public void Test(int valeur)
    {
      //Do something
    }

    #endregion 

And this code in my Silverlight application

 Context.Test(2, action =>
        {
           // Do somet开发者_JAVA百科hing
        }, null);

The function SelectAll, Update, Delete , Insert work's fine but the 'Test' function generated the following error:

an attempt was made to load a program with an incorrect format

any ideas ?


I have found that if i write the function invocation like this it's works

Context.Test(2,new System.Action<InvokeOperation<Int>>(ModeleEnvoiEa_Completed),null);            

    }

    void ModeleEnvoiEa_Completed(InvokeOperation invoke)
    { 
      // Do something
    }

but if i use a lambda expression like this, i have an error, why ?

Context.Test(2, action =>
    {
       // This code generate an error
       // an attempt was made to load a program with an incorrect format
    }, null);
0

精彩评论

暂无评论...
验证码 换一张
取 消