I'm getting the infamous errors trying to serialize graphs of instances, 
along the lines "not-null property references a null or transient value X", 
but I can promise you upon inspection, approaching save, I am confident the 
instances are wired how they should be wired. But NH seems incapable of not 
getting wrapped around its axel over the matter.

Not sure how better to proceed with it. 

https://github.com/nhibernate/fluent-nhibernate/discussions/762

Is there a discord or something over which I may briefly present and so 
forth? Even a join on the CSharp discord would be helpful.

Cheers thank you!

On Sunday, October 26, 2025 at 9:43:38 PM UTC-4 Michael W Powell wrote:

> Trying a slightly different tact, instead of M2M joining table, there is 
> no reason for the Owner to be more than a column or property, since Vehicle 
> can have only one Owner. However, in this approach, Vehicle effectively has 
> one and a half parents. One parent a Not Nullable, MotorVehicleDivision. 
> The other parent, a Nullable, Player Owner.
>
> See discussion: 
> https://github.com/nhibernate/fluent-nhibernate/discussions/762
>
> Open to suggestions how to persuade the relationship to behave properly. 
> On the Owner side, I've tried Refresh Cascade, same sort of effect, does 
> not work. Also None Cascade.
>
> On Wednesday, October 22, 2025 at 6:35:52 PM UTC-4 Michael W Powell wrote:
>
>> Perhaps I am not mapping it quite right either side of the relationship.
>>
>> From the player:
>> HasManyToMany(x => x.VehicleRegistrations)
>>     .Cascade.AllDeleteOrphan()
>>     .Table(JoinNames([TableNames.efcore, TableNames.wbe, 
>> nameof(VehicleRegistration).ToLower()]));
>>
>> From the vehicle:
>> HasManyToMany(x => x.VehicleRegistrations)
>>     .Cascade.AllDeleteOrphan()
>>     .Inverse()
>>     .Table(JoinNames([TableNames.efcore, TableNames.wbe, 
>> nameof(VehicleRegistration).ToLower()]));
>>
>> Whereas this somewhat dated example:
>>
>> https://belter.io/manytomany-fluentnhibernate not mentioning any joining 
>> object whatsoever, which is a bit interesting to me.
>>
>> Question though, in my joining table, what happens if I want to identify 
>> additional bits in that part of the model? i.e. is not just "joining two 
>> tables, with two FK references" and so forth.
>>
>> If I go by the example, it appears to me the map drills right through 
>> that would-be entity.
>>
>> Anyone?
>>
>> Thanks...
>>
>> On Wednesday, October 22, 2025 at 6:14:40 PM UTC-4 Michael W Powell wrote:
>>
>>> Also it's not the only columns which are misidentified, or that I have 
>>> not trained the ORM how to identify, YET... Which is what I'd like to 
>>> puzzle through if it is even possible, vehiclereg0_.Player_id.
>>>
>>> Honestly I'm not even sure how this SQL is being formed, unless perhaps 
>>> I have a relationship or reference inversion incorrect perhaps.
>>>
>>> SELECT vehiclereg0_.Player_id as player4_5_9_, 
>>> vehiclereg0_.VehicleRegistration_id as vehicleregistration5_5_9_, 
>>> vehiclereg1_.Id as id1_5_0_, vehiclereg1_.PlayerId as playerid2_5_0_, 
>>> vehiclereg1_.VehicleId as vehicleid3_5_0_, player2_.Id as id1_4_1_, 
>>> player2_.ServerProfileId as serverprofileid2_4_1_ ...  left outer join 
>>> public.efcore_wbe_serverprofile serverprof9_ on 
>>> motorvehic6_.ServerProfileId=serverprof9_.Id WHERE vehiclereg0_.Player_id=?
>>>
>>> The example SQL above, not even sure how the majority of all this is 
>>> even necessary, seems like extraneous junk happening somehow, because I am 
>>> mapping a joining table? Is there a better base mapping class for that, 
>>> perhaps? I'm not sure...
>>>
>>> On Wednesday, October 22, 2025 at 6:08:40 PM UTC-4 Michael W Powell 
>>> wrote:
>>>
>>>> Getting some errors after mapping the joining table. It is for whatever 
>>>> reason looking for a column i.e. vehiclereg0_.vehicleregistration_id, vreg 
>>>> being object 'table'. The base model Id property should be this:
>>>>
>>>> Id(x => x.Id)
>>>>     .Column(nameof(ModelBase.Id))
>>>>     .Not.Nullable()
>>>>     .GeneratedBy.GuidComb();
>>>>
>>>> Not sure why the joining is trying to label it "vehicleregistration_id" 
>>>> that is definitely incorrect.
>>>>
>>>> How to persuade NH? Fluent NH? How to map it correctly?
>>>>
>>>> The only columns that should really be mapped otherwise are:
>>>>
>>>> References(x => x.Owner)
>>>>     .Not.Nullable();
>>>>
>>>> References(x => x.Vehicle)
>>>>     .Not.Nullable();
>>>>
>>>> TBD what level of inverse relationship there should be.
>>>>
>>>> Note, vehicle can only be registered to one player at a time, so 
>>>> perhaps M2M is overkill.
>>>>
>>>> Thoughts?
>>>>
>>>> Thank you...
>>>>
>>>> On Wednesday, October 1, 2025 at 6:02:14 PM UTC-4 Michael W Powell 
>>>> wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> I want to map a joining table between A and B. I have a sense how to 
>>>>> map the A and B sides of the relationship, one of which I think should be 
>>>>> .Inverse(), yes?
>>>>>
>>>>> I am not hundred percent positive, but I may need to attach additional 
>>>>> properties than just linking A to B and vice versa.
>>>>>
>>>>> So I need to introduce a map for the joining table C as well. But, 
>>>>> personally, I'm not quite sure how that would work.
>>>>>
>>>>> Any insights?
>>>>>
>>>>> Best, thank you...
>>>>>
>>>>> Michael W. Powell
>>>>>
>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/fluent-nhibernate/a558e0c1-6083-4409-ac8f-aee0d8bb8cecn%40googlegroups.com.

Reply via email to