Code help

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Il y a 11 ans
Hi,

I'm implementing some changes for my customer and I can't understand how the customer Class is linked to the GenericAttributeExtentions.

If I need to link my custom class to this extensions, how can I do?

Thanks, Domenico.
Il y a 11 ans
Search the solution for SystemCustomerAttributeNames.Gender, to see how its used
Il y a 11 ans
The problem is, I can't see the method GetAttribute from my customer class...

Like Customer.GetAttribute(...)
Il y a 11 ans
GetAttribute is an extension of BaseEntity. Make sure to reference and import Nop.Services.Common and that your class derives from BaseEntity
Il y a 11 ans
Yes, I did it... But it doesnt' work...
Il y a 11 ans
This works for me:

        public class TestClass: BaseEntity
        {
            public string SureItWorks { get; set ; }
        }

        private void Testing()
        {
            var t = new TestClass() ;
            t.Get   <== here I get intellisense for GetAttribute
        }
Il y a 11 ans
Yes, it works.

But if you write this code inside another xxx.Services project, this doesn't works.

I've referenced the all the same assembly of original Nop.Services project...

What I miss?
Il y a 11 ans
You need to reference nop.services.dll for Nop.Services.Common.GenericAttributeExtentions
You need to reference nop.core.dll for Nop.Core.BaseEntity
Il y a 11 ans
Yes, already did it but with no luck.
Il y a 11 ans
You also need
using Nop.Core.Domain.Customers;

What doesn't work?  Are you getting a syntax error?  (what is it?)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.