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

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

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>

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 28, 2026, 11:44
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.