Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "antonis"

The instance will be created the first time someone requests it, and subsequently reused every time it's needed Take as example the EntityCache which is a singleton. It is using the dbcontext to get the entity from database if I am not mistaked. The first request that comes in the controller that uses an EntityCache is gonna use the dbcontext that was created for the first request. Is that right?

@mailming I understand how DI works. What I am asking how are they being initialized in abp?

Answer

Yes I totally understand this. Mostly I intend to use it for entries that are not created/updated/deleted

Why it is not recommended?

Answer

What do you mean?

Answer

Eventually I have to write my own cache. I think this functionality is very easy to be added to existing ITypeCache since it is very easy to implement it.

Answer

I am confused.

It automatically invalidates a cached entity if this entity is updated or deleted. Thus, it will be retrieved from the database in the next call.

and then you said that:

If your entity changes frequently, you can consider adding/deleting/updating the cached list Dto when certain entities are changed. Of course this is cumbersome.

Is it creating/updating/deleting or I have to do it manually

If your entity does not change often, you can directly store the Dto of the list in the cache, and re-query the list Dto update cache when some entities change.

How can I do that?

Answer

It lacks one very important thing though. No way to retrieve all objects at once (list) but instead I can only retrieve it one by one. This is very inefficient especially in cases that you want to return to client an OutputDto which contains list of items for drawing controls (e.g Countries dropdown need to get all countries)

Answer

So every time a create/update/delete an entity from the database the Cache dto is updated?

Thanks

Thanks you. That did the trick

Showing 21 to 30 of 130 entries