Open Closed

Readonly access to entity #9115


User avatar
0
paul.harriman created

I need to access 3 entities that do not have a primary key. the access needed is read only. It looks like I can do it from reading the documentation, but I am having difficulties.

  • I started out with Suite creating an entity with a key.
  • Then went to the Domain and Contracts and removed the inheritance to Entity<Guid>/EntityDto<Guid>
  • I changed the inheritance on the interfaces to the repos to: public interface IEdRepository : IRepository
  • I removed all updates/inserts/getAsync(id)
  • I got to the repositories and that's where the trouble started. I need to change the class from public class EfCoreEdRepository : EfCoreRepository<DataDbContext, Ed, Guid>, IEdRepository to something keyless.

For these entities i just need to show them in a grid and do some paging, filtering and advanced finds. So all I need is GetListAsync


1 Answer(s)
  • User Avatar
    0
    paul.harriman created

    I might have found something that works

    I changed the Entity to inherit from Entity<long>

    added

            [NotMapped]
            public override long Id
            {
                get { return 0; }
                protected set { }
            }
    

    change the repo to public class EfCoreEdRepository : EfCoreRepository<DataDbContext, Ed>

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.3.0-preview. Updated on April 16, 2025, 12:13