Receiving the following message: Csla.Core.BusinessCase.CanReadProperty(Bool) is obsolete

Receiving the following message: Csla.Core.BusinessCase.CanReadProperty(Bool) is obsolete

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


jscontreras posted on Sunday, January 18, 2009

Hi,
I'm receiving the message Csla.Core.BusinessCase.CanReadProperty(Bool) is obsolete when using the following code:

 public Guid Id
        {
            [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
            get
            {
                CanReadProperty(true);
                return _Id;
            }
        }

I'm using the PTracker sample from ASP.NET 2.0 migrated to 3.5 sp1 and using the 3.6 Framework I believe.  I did this because the PTracker is not available for 3.6 (I didn't see a download).

How do I fix the issue above?   What exactly do I need to do without modifying the framework.

I really don't want to start getting into the framework just yet.  I've only been using for about 2-3 days.

Thanks,

RockfordLhotka replied on Sunday, January 18, 2009

ProjectTracker is in the Samples download.

That overload of CanReadProperty() is obsolete because it has reliability and performance issues.

You should use one of the other overloads:

CanReadProperty(string, bool); // pass in property name

CanReadProperty(PropertyInfo<T>, bool); // pass in property info token

Or move to the newer property declaration syntax available in 3.5+

public Guid Id
{
  get { return GetProperty(IdProperty, _Id); }
}

 

jscontreras replied on Sunday, January 18, 2009

Hi,
Thanks for the quick response:
I've upgrade to the 3.5 framework (Business and .NET) build the 3.5 CSLA created a new reference to my BO Project and added this:

private byte[] mTimestamp = new byteMusic [8];

    private static PropertyInfo<Guid> IdProperty =
      RegisterProperty<Guid>(typeof(Project), new PropertyInfo<Guid>("Id"));
    [System.ComponentModel.DataObjectField(true, true)]
    public Guid Id
    {
      get { return GetProperty<Guid>(IdProperty); }
    }

I was able to build the BO project.
Just getting use to the new Framework.  BTW I was able to create the BO for my framework in no time.  And I also noticed in the 2008 version you're using LINQ does this make the SQL more efficient (I've only done some simple examples with LINQ).

Thanks,

RockfordLhotka replied on Sunday, January 18, 2009

LINQ to SQL is technically less efficient than raw ADO.NET. But the code is simpler – so it is really a choice of maintainability vs performance to some degree.

 

One note about the property declaration – there’s a slightly better (more maintainable) syntax available in 3.6:

 

    private static PropertyInfo<Guid> IdProperty =
      RegisterProperty<Guid>(new PropertyInfo<Guid>("Id"));
    [System.ComponentModel.DataObjectField(true, true)]
    public Guid Id
    {
      get { return GetProperty(IdProperty); }
    }

Note that the first parameter of RegisterProperty() is gone, and you don’t need the type parameter on GetProperty()/SetProperty() because the compiler can infer the right type.

 

Rocky

 

 

From: jscontreras [mailto:cslanet@lhotka.net]
Sent: Sunday, January 18, 2009 12:18 PM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] Receiving the following message: Csla.Core.BusinessCase.CanReadProperty(Bool) is obsolete

 

Hi,
Thanks for the quick response:
I've upgrade to the 3.5 framework (Business and .NET) build the 3.5 CSLA created a new reference to my BO Project and added this:

private byte[] mTimestamp = new byteImage removed by sender. Music <img src=">;

    private static PropertyInfo<Guid> IdProperty =
      RegisterProperty<Guid>(typeof(Project), new PropertyInfo<Guid>("Id"));
    [System.ComponentModel.DataObjectField(true, true)]
    public Guid Id
    {
      get { return GetProperty<Guid>(IdProperty); }
    }

I was able to build the BO project.
Just getting use to the new Framework.  BTW I was able to create the BO for my framework in no time.  And I also noticed in the 2008 version you're using LINQ does this make the SQL more efficient (I've only done some simp le examples with LINQ).

Thanks,


Copyright (c) Marimer LLC