C#C
C#4y ago
Adnan307

❔ Ef Core Constructor problem

Hello its my first big project with ef. I have an class with 3 attributes and one constructor that is calling the base constructor. My Class inherit from another class.
public class SPlayer : Player
    {
        public new int Id { get; set; }
        public Account Account { get; set; }
        public string Name { get; set; }

        public SPlayer(ICore core, IntPtr nativePointer, ushort id) : base(core, nativePointer, id)
        {

        }
    }

The problem is that ef core need an parameter less constructor. I tried to add an private constructor but its not working.
No suitable constructor was found for entity type 'SPlayer'. The following constructors had parameters that could not be bound to properties of the entity type: 
    Cannot bind 'core', 'nativePointer', 'id' in 'SPlayer(ICore core, IntPtr nativePointer, ushort id)'
Note that only mapped properties can be bound to constructor parameters. Navigations to related entities, including references to owned types, cannot be bound.
Was this page helpful?