Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error Property set method not found when using RowVersion and UseLazyLoadingProxies at same time #138

Closed
witskeeper opened this issue Jan 9, 2025 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@witskeeper
Copy link
Member

witskeeper commented Jan 9, 2025

entity

public class Order : Entity<OrderId>, IAggregateRoot
    {
        /// <summary>
        /// 
        /// </summary>
        protected Order()
        {
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        /// <param name="count"></param>
        public Order(string name, int count)
        {
            this.Name = name;
            this.Count = count;
            this.CreateTime = DateTime.UtcNow;
            this.OrderItems.Add(new OrderItem(name, count));
            this.RowVersion = new RowVersion(0);
            this.AddDomainEvent(new OrderCreatedDomainEvent(this));
        }

        public RowVersion RowVersion { get; private set; } = new RowVersion(0);

    }

Error:

Property set method not found.\n ---> System.ArgumentException: Property set method not found.\n at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)\n at NetCorePal.Extensions.Repository.EntityFrameworkCore.AppDbContextBase.UpdateRowVersionBeforeSaveChanges(ChangeTracker changeTracker) in /Users/xiao/code/netcorepal-cloud-framework/src/Repository.EntityFrameworkCore/AppDbContextBase.cs:line 157\

@witskeeper witskeeper added the bug Something isn't working label Jan 9, 2025
@witskeeper witskeeper added this to the v2.1.x milestone Jan 9, 2025
@witskeeper
Copy link
Member Author

移除 private 可以临时修复

public RowVersion RowVersion { get; set; } = new RowVersion(0);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant