Bto use AUrelius.eginner Question: Is this duable?

Hello, I am rewriting a software and want to use Aurelius. The heart of the system is a dictionary based patient file that is usually displayed in a grid. I want to use MVVM pattern and think of creating the MV Layer in Aurelius.

The system is a bit tricky thats why I ask myself whether or not to use Aurelius:

The x-axis is a series of visits of the patient and the y-axis is the series of data types (like blood pressure, weight, height...).  The data itself is stored in items that are both related to one visut and to a data type. This Matrix is of course sparse. Asit mayhappen that there are no items for one data type I have to load the complete list of data types upfront and then load the visits and items. 

The question is: Is it possible to load the entity "type" upfront and later load "visits" and "items" having the "item"-objects relate to the "type"-objects although they are not loaded together?

I hope one can understand the question I have. Thanks for advice!


Sorry for the bad title and text. It was late and I oversaw that I accidently typed something into the title before sending it...


I got a bit confused with your requirement, but from what I understand, you have a view (UI) issue and you are trying to fit (or build) a business model into it. Not sure if that's the best approach.
For complex UI like this I would suggest you just create model (or modelview) classes that are specific to that view, and manually fill them from Aurelius entities.
Aurelius would still help in this case as your code would be cleaner since you are using pure objects instead of mixing objects and SQL. Maybe you can still use the entities retrieved directly from the database in the view, but I can't tell you that from the information, and as I said, I wouldn't shape my business/database objects based on a specific view.

Confusing question causes confusion ;-) Sorry for that. I am currently building a small "model" of the big thing I want to build. Yes, I will build a layer between aurelius and the ui. I do not shape the business model on the ui, the ui here reflects the way the patient file is organized. The precise question regarding aurelius is:

If I load the entity Type completely into a list<TType> and keep that for the lifetime of my layer object for performance reasons. Later I want to load item-Entities that reference these Type-Entities. Will they automatically reference the type-objects or will Ihave to fill these References manually?  

If the latter is the case, perhaps Aurelius will not help that much in my design.

Thanks for your effort (and patience)


SOrry for the bunch of dumb questions. I Think I had it completely wrong. The Manager deals with syncing the objects with the database, right? So if everything takes place within one manager I can rely on the associations being correct (In my models every table has a identity ID field as pimary key and I use foreign keys wherever possible). So now I believe: Whenever I request things through the manager, he will take care of pulling / lazy loading the referenced objects. Is that correct? This alone makes things more easy. The one question remains: Can I clear partially objects from the manager if I e.g. load a new patient file and do not need some of the already loaded objects of the pevious one. Or does it make sense to free the manager and always use a new one?

I would like to add that I am talking about bigger amounts of data (some customers's item table has hundret millions of records). That's also why I am concerned of memory usage and performance.

If you load everything using the same manager, yes, Aurelius will handle the associations automatically. It also optimizes it, say you have 500 entries associated with the same patient with id 1. It will load the patient 1 only once, and for the 500 entries, it will lookup in the cache and associate all entries with same patient 1 object without reloading it all the time.

Having said that, it's always questionable that you are going to handle hundreds of millions of objects using ORM, or even without ORM, loading all that data at once client side. Probably you should load only part of that data at each time. If you really need to load millions of records at once and need high performance, maybe ORM is not your choice.

That sounds perfect. By the way: The database holds this many items but they belong to different patient files and will never be loaded all! But as the tables are huge, there is a big difference to a normal customer database.

Is it possible to free the cached items that only belong to one patient while keeping the common items already loaded and load a different patient with his associations? Or would it make more sense to free the manager and create a new one (with the drawback that everything has to be fetched from the database)?

Also I have other models that make up one object like User and so on. Is there a lot of overhead when I create lets say 10 managers at one time dealing with different submodels of the complete database?


You can manually remove specific entities from the manager by using Evict method - you should then destroy the object yourself, as it's not exactly "clearing the cache" but just making the object not manageable anymore. More info:

I'm not sure if it's worth, though, I'd only recommend this if you really need such optimizations. Just keep using the cache (do not keep it to long, or use global managers, though), or simply clear the manager and reload data.

There is almost none overhead in creating an object manager. If using several different managers fit your needs, go ahead, no issues about that. Just remember that objects from one manager do not mix with objects from other manager, i.e., all the associated objects, references etc., will be "duplicated" in each manager (if manager A and B needs a reference for TUser with id = 1, each one will load its own instance of such object).