Skip to content

Error while mapping proxies for Entities in net9.0 #716

Closed as not planned
Closed as not planned
@sukreshmanda

Description

@sukreshmanda

Dotnet Version: 9.0.100-preview.7.24407.12

Fluent-NHibernate Version: 3.4.0

Code Used

public class Employee
    {
        public virtual string Name { get; set; }
        public virtual long Id { get; set; }
    }

    public class EmployeeMap : ClassMap<Employee>
    {
        public EmployeeMap()
        {
            Table("employee");
            Id(e => e.Id).CustomSqlType("Serial").GeneratedBy.Native();
            Map(e => e.Name).Column("name");
        }
    }

Error:

NHibernate.InvalidProxyTypeException: The following types may not be used as proxies:
TodoAPI.Models.Employee: method MemberwiseClone should be 'public/protected virtual' or 'protected internal virtual'
   at NHibernate.Cfg.Configuration.ValidateEntities()
   at NHibernate.Cfg.Configuration.Validate()
   at NHibernate.Cfg.Configuration.BuildSessionFactory()
   at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions