Problem with static method for deleting

Problem with static method for deleting

Old forum URL: forums.lhotka.net/forums/t/2560.aspx


RichardETVS posted on Tuesday, March 20, 2007

Hi

 

I try the following code, in the BO class:

 

public static void DeleteEditableRoot(long Id)

        {

            Csla.DataPortal.Delete(Id);

        }

 

But I get an exception in MethodCalle.cs:

 

    public static MethodInfo FindMethod(Type objType, string method, Type[] types)

    {

      MethodInfo info = null;

      do

      {

        //find for a strongly typed match

        info = objType.GetMethod(method, oneLevelFlags, null, types, null);

 

The problem is that objType is null. Well, probably I am doing something wrong, but what?

 

Thanks for any help.

 

Richard

 

System.NullReferenceException was unhandled

  Message="La référence d'objet n'est pas définie à une instance d'un objet."

  Source="Csla"

  StackTrace:

       at Csla.MethodCaller.FindMethod(Type objType, String method, Type[] types) in MethodCaller.cs:ligne 210

       at Csla.MethodCaller.GetMethod(Type objectType, String method, Object[] parameters) in MethodCaller.cs:ligne 146

               at Csla.DataPortal.Delete(Object criteria) in Client\DataPortal.cs:ligne 352

       at BusinessObjects.EditableRootUnChamp.DeleteEditableRoot(Int64 Id) in EditableRootUnChamp.cs:ligne 165

RockfordLhotka replied on Tuesday, March 20, 2007

DataPortal.Delete() accepts a criteria object. The Criteria class must either be nested inside your business class, or it must inherit from CriteriaBase (which forces you to specify your business object type).

RichardETVS replied on Thursday, March 22, 2007

Ok, thanks :)

Copyright (c) Marimer LLC