Cannot convert lambda expression to type

Jul 10, 2010 at 9:25 PM

Hello,

Thank you on this.extension. I am spending some of my time on learning csla.net with this nice extension and i am trying to work with it on my project.
Today i downloaded a new extension from this site and runned in problem, this error showes up:


Error 1 Cannot convert lambda expression to type 'Csla.PropertyInfo' because it is not a delegate type

on line:

protected static PropertyInfo<short> GrupaIDProperty = RegisterProperty<short>(c => c.GrupaID);

 

Even when i create a new solution / project, this problem won't go away.
Has anybody been having problems with this ?





Developer
Jul 10, 2010 at 10:56 PM

Hi!

Take a look at http://forums.lhotka.net/forums/p/6865/32887.aspx. You probably reference old version of Csla.dll.

 Lino

Jul 11, 2010 at 3:36 PM

Thank you, i solved my problem.

Nov 10, 2010 at 9:55 AM

Hi Orecj

Could you share the solution please - I'm having the same problem and could do with sorting it out - frustrating

Thanks

Nick

Coordinator
Nov 10, 2010 at 10:37 AM

Hi nkgraham.

Which CSLA version are you using? Please post more info about this error.

Regards,

Josip

May 20, 2013 at 9:10 PM
I'm using Csla 4.3.13.0 and receiving the 'Cannot convert lambda expression to type 'Csla.PropertyInfo<decimal>' because it is not a delegate type' compiler error.

The OrderBase class defines Id, Name, and ItemCost as follows:
    public abstract class OrderBase : BusinessBase<OrderBase>
    {
        #region Business Methods

        // TODO: add your own fields, properties and methods

        // example with private backing field
        public static readonly PropertyInfo<int> IdProperty = RegisterProperty<int>(p => p.Id, RelationshipTypes.PrivateField);
        private int _Id = IdProperty.DefaultValue;
        public int Id
        {
            get { return GetProperty(IdProperty, _Id); }
            set { SetProperty(IdProperty, ref _Id, value); }
        }

        // example with managed backing field
        public static readonly PropertyInfo<string> NameProperty = RegisterProperty<string>(p => p.Name);
        public string Name
        {
            get { return GetProperty(NameProperty); }
            set { SetProperty(NameProperty, value); }
        }


        public static readonly PropertyInfo<decimal> ItemCostProperty = RegisterProperty<decimal>(c => c.ItemCost);
        public decimal ItemCost
        {
            get { return GetProperty(ItemCostProperty); }
            set { SetProperty(ItemCostProperty, value); }
        }
However, when inheriting from this clsass and attempting to add the property 'FreightCost' as follows:
    public class Invoice : OrderBase
    {

        public Invoice()
        {
        }

        public static readonly PropertyInfo<Decimal> FreightCostProperty = RegisterProperty<Decimal>(c => c.FreightCost);
        public Decimal FreightCost
        {
            get { return GetProperty(FreightCostProperty); }
            set { SetProperty(FreightCostProperty, value); }
        }
    }
I receiving the compiler exception. What am I doing wrong?