I've an entity name Listing like below.
public class Listing : FullAuditedEntity<long, User>, IPassivable
{}
I'm studing EntityCaching here. <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Caching#entity-caching">http://www.aspnetboilerplate.com/Pages/ ... ty-caching</a>
I created these codes by respecting documentation.
public interface IListingCache : IEntityCache<ListingDto>
{
}
public class ListingCache : EntityCache<Listing, ListingDto>, IListingCache, ITransientDependency
{
public ListingCache(ICacheManager cacheManager, IRepository<Listing, long> repository)
: base(cacheManager, repository)
{
}
}
At coding time there are errors like below
Listings.Listing' cannot be used as type parameter 'TEntity' in the generic type or method 'EntityCache<TEntity, TCacheItem>'. There is no implicit reference conversion from Listings.Listing' to 'Abp.Domain.Entities.IEntity<int>'.
Listings.Listing, long>' to 'Abp.Domain.Repositories.IRepository<Listings.Listing, int>'
These errors dis appears if i change Entity id type to int from long. So, question is basic. Cant i use EntityCache with long type? Or should i use ICacheManager?
By the way im not familiar with these caching things. What is different between ICacheManager and EntityCache? Ty.
1 Answer(s)
-
0
Hi,
You can use entities with long primary keys just define your interface and class like this,
public interface IListingCache : IEntityCache<ListingDto, long> { }public class ListingCache : EntityCache<Listing, ListingDto,long>, IListingCache, ITransientDependency { public ListingCache(ICacheManager cacheManager, IRepository<Listing, long> repository) : base(cacheManager, repository) { } }There is noting different actuallay, it's a special version of caching. From documentation
While ASP.NET Boilerplate's cache system is general purpose, there is an EntityCache base class that can help you if you want to cache entities.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)