Click here to Skip to main content
15,891,567 members

Comments by Adam Flow (Top 5 by date)

Adam Flow 2-Jan-22 8:28am View    
Yes.... I realized that after I wrote the answer. -.-
I guess I was too enthusiastic. Oh, well...
From now on, I will check the date first ;-)
Adam Flow 1-Jan-22 20:21pm View    
We use NHibernate with Fluent on both SQL Server and Oracle. I can say, that we use the same Fluent mappings for both databases.

There are some slopes, for example: Oracle has a 30 character limit on column and constraint-names (foreign-keys, indexes). So if you keep that in mind and have your column names at 30 characters max. by default, then this is no problem.

Also, if you planning to use only the "basic" types (integer, long, string, boolean) in your project, then there should be no problems as well.

You will only have to deal with two different NHibernate configurations. Specifically the Database-Driver class, Connection string and Dialect which are in turn just parameters for your NHibernate configuration. No big deal.

So, what do you have in mind specifically that could lead to potential issues?
What blogs did you read that made you uncertain?
Adam Flow 1-Jan-22 13:51pm View    
Deleted
Update:

When i look at the Class Diagram, you could also use the ProcessActionLog class as a container, which simply has a list of ProcessActionDetail. The ProcessActionDetail is the abstract base class for all the other subclasses.

The ProcessActionType is then merely a business related discriminator. You would have to lay out your business logic accordingly to make sure, that one specific ProcessActionType container can only have the corresponding subclasses in its list.

I will create an example for both solutions.
Adam Flow 1-Jan-22 8:00am View    
Deleted
This is a very interesting problem. I'd like to help but i need some information:

1. Is your project already "live"? Can you still change your database tables and classes,
or are you trying to integrate NHibernate to a existing project?

The reason i asked, is because NHibernate has different strategies for its inheritance mapping:
https://nhibernate.info/doc/nhibernate-reference/inheritance.html

What i usually use is the "table per subclass" strategy, which does not necessarily need a discriminator column.
"ProcessActionType" in your case. Section 9.1.3 in the documentation.

So my suggestion is, that you go with the "table per subclass" strategy without the discriminator column as described in section 9.1.2.
But this depends on whenever you can still change your classes and tables.

Think of it as regular Object-Oriented approach:
ProcessActionLog would be an abstract base class which has all the common Properties.
It is mapped using ClassMap<T> from Fluent NHibernate.
Every subclass of ProcessActionLog should inherit from that base class and only have the specific individual Properties in addition.
Those are then mapped using SubclassMap<T>

This way, you can get rid of the ProcessActionType discriminator and simply query over the concrete subclasses.
The ID in every subclass table is both primary-key in that table and foreign-key reference to the base table ID at the same time.

So, can you still modify you classes and tables?
Adam Flow 1-Jan-22 7:34am View    
This looks like the usual Visual Studio hickup to me.
At 0:32 you clicked on the error entry and jumped to the code line for Sys_Users_SkillBooks.
It was underlined red for a second and then went fine.
Try to cleanup the solution, restart Visual Studio and rebuild your whole solution again.

I encounter this "phenomenon" too, occasionally. Especially when i switch between different solutions.

If you have Resharper installed, you can also do a Cache Cleanup.