Hi,
Our LLBLGEN Pro version is 5.7 and we are using the adapter pattern.
We are currently using generics in order to create a caching layer in front of the Entity Type. We recently found out that this causes issues due to the fact that the Entity should not be cached, per one of the websites documentations.
We were looking to use DTO's instead in order to cache rather than an Entity, but realized that the templates generating DTO's have no base class and that the Persistence classes are DTO object specific.
So I wanted to ask, are there any extensions or templates that I need to look at to enable a feature that allows us to use DTO objects as if they were first class citizens of the framework, rather than the Entity?
I'm providing a very small set of code here, all from the same class:
(I am withdrawing some parts of the code so as to obfuscate our IP, so I hope it comes across well enough)
public class DataCache<TEntity> where TEntity : EntityBase2, IEntity2
Then to get an item from the adapter, we will use one of the Fetch functions, here is an example that has been simplified down:
public TEntity FetchEntityByPK(..)
{
...
GetFromDB<TEntity>()
...
}
private static TItem GetFromDB<TItem>(TItem itemIn)
{
....
adapter.FetchEntity((IEntity2)itemIn);
value = itemIn;
return value;
....
}
Since the Persistence classes that are tied to a DTO have a very specific name, e.g. ProjectToJobDto in the case of a Job table, i've hit a dead end with where the code currently is at the moment.
Also, my assumption, since the Entity is also being used within the Persistence classes within said ProjectToJobDto, e.g.:
public static ABP.Db.DtoClasses.JobDerivedDto ProjectToJobDerivedDto(this ABP.Db.EntityClasses.JobEntity entity)
is that an Entity is a first class citizen and the DTO is a byproduct of wanting a disconnected POCO.
So that's where my question lies, is if I can take this further with the hopes that perhaps I have missed something and that there are a set of other libraries or extensions that I do not know about that could help us bridge the gap of replacing the Entity for a DTO by using generics.