Problem adding in new Criteria to BOList

Problem adding in new Criteria to BOList

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


Jack posted on Tuesday, February 17, 2009

Hi,

I'm doing something daft but I keep getting a Error   in my nonSilverlight GetMyProgramList method.  I tried to add a custom CriteriaBase so I can pass a string and an enum representing the type of filtering I want to do (basically change to a string in my SP).

I know its something simple but I'm going in circles.

thanks

The non-generic method 'Epm.Library.MyEpm.MyProgramList.DataPortal_Fetch(Epm.Library.MyEpm.MyProgramList.MyProgramCriteria)' cannot be used with type arguments   

on my call to dataPortal_Fetch

Here is my simple implementation:

using System;
using Csla;
using Csla.Server;
using Epm.Library.Framework;
using AlexanderGracie.Library.Framework;

namespace Epm.Library.MyEpm
{
    public partial class MyProgramList : EpmBusinessListBase<MyProgramList, MyProgram>
    {
        #region Factory Methods

        public static void GetMyProgramList(string userId, MyProgram.MyProgramFilter filter, EventHandler<DataPortalResult<MyProgramList>> handler)
        {
            DataPortal<MyProgramList> dp = new DataPortal<MyProgramList>();
            dp.FetchCompleted += handler;
            dp.BeginFetch(new MyProgramCriteria(typeof(MyProgramList), userId, filter));
        }

#if !SILVERLIGHT
        public static MyProgramList GetMyProgramList(string userId, MyProgram.MyProgramFilter filter)
        {
            return DataPortal_Fetch<MyProgramList>(new MyProgramCriteria(typeof(MyProgramList), userId, filter));
        }
#endif
        //public static MyProgramList GetMyProgramList(AgcSafeDataReader dr)
        //{
            //return DataPortal.Fetch<MyProgramList>(dr);
        //}

        #endregion

        #region Data Access

        [Serializable]
        public class MyProgramCriteria : CriteriaBase
        {
            private string _userId;
            public string UserId { get { return _userId; } }

            private MyProgram.MyProgramFilter _filter;
            public MyProgram.MyProgramFilter Filter { get { return _filter; } }
           
            //, MyProgram.MyProgramFilter filter

            public MyProgramCriteria(Type type, string userId, MyProgram.MyProgramFilter filter): base(type)
            {
                _userId = userId;
                _filter = filter;
            }
        }

#if !SILVERLIGHT

        private void DataPortal_Fetch(MyProgramCriteria criteria)
        {
            RaiseListChangedEvents = false;

            ...

            RaiseListChangedEvents = true;

        }

#endif //!SILVERLIGHT


        #endregion //Data Access
    }

}

Jack replied on Tuesday, February 17, 2009

Almost embarrassed to put the solution in:

return DataPortal_Fetch<MyProgramList>(new MyProgramCriteria(typeof(MyProgramList), userId, filter));

should have read:

return DataPortal.Fetch<MyProgramList>(new MyProgramCriteria(typeof(MyProgramList), userId, filter));

No more long weekends.

Copyright (c) Marimer LLC