Ah I see what I did. I was literally trying to save the unmapped 
SocketGuild, presented a different collection instance than the one I had 
intended. Oops!

On Saturday, June 21, 2025 at 4:09:28 PM UTC-4 Michael W Powell wrote:

> Hello,
>
> In my class map, I have the following.
>
> public class DiscordGuidMap : DiscordModelBaseMap<DiscordGuild, 
> SocketGuild>
> {
>     public DiscordGuidMap() : base()
>     {
>         Map(x => x.Name)
>             .Length(DiscordModelBase.NameMaxLength)
>             .Not.Nullable();
>
>         Map(x => x.Description)
>             .Length(DiscordGuild.DescriptionMaxLength)
>             .Nullable();
>  
>         HasMany(x => x.TextChannels)
>             .AsBag()
>             .Cascade.AllDeleteOrphan().Inverse();
>     }
> }
>
> There is an internal property Source which we pick up the SocketGuild in 
> this case, and for DiscordTextChannel the SocketTextChannel as well.
>
> These are properly unmapped, should not be mapped.
>
> I got this to save or update "once" now does not seem to work again, 
> getting the infamous "no persister for". Now with the exception messages:
>
> - $exception {"An invalid or incomplete configuration was used while 
> creating a SessionFactory. Check PotentialReasons collection, and 
> InnerException for more detail.\r\n\r\n"} 
> FluentNHibernate.Cfg.FluentConfigurationException
> + InnerException {"Could not determine type for: 
> Discord.WebSocket.SocketGuild, Discord.Net.WebSocket, Version=3.15.3.0, 
> Culture=neutral, PublicKeyToken=null, for columns: 
> NHibernate.Mapping.Column(Source)"} System.Exception 
> {NHibernate.MappingException}
>
> Note, there should NOT be a persister for Source, nor do we want to map 
> that property, it is strictly for internal use only.
>
> My mappings are properly configured including ClassMap<t> from the 
> appropriate assemblies.
>
> private static void OnMappingConfiguration<TMappingProvider, 
> TConvention>(MappingConfiguration mappingConfiguration)
>     where TMappingProvider : class, IMappingProvider
>     where TConvention : class, IConvention
> {
>     mappingConfiguration.FluentMappings
>         .Conventions.AddFromAssemblyOf<TConvention>()
>         .AddFromAssemblyOf<TMappingProvider>();
> }
>
> private static (string appSettingsPath, Action<MappingConfiguration> 
> onMapping, Action<Configuration> onExpose) _configurationHandlers = (
>     "appsettings.json"
>     , OnMappingConfiguration<CredentialMap, PrimaryKeyConvention>
>     , delegate { }
> );
>
> And we deconstruct the tuple and use accordingly in the correct places. 
> We're "this far" as evidence things are wired and plumbed correctly.
>
> The only way we could be getting that exception is if somehow Source is 
> somehow being seen and included in the map, which it should not be. And 
> solutions I have seen in some forums to annotate with an [Ignore] or 
> perhaps [NotMapped attribute, not a desirable approach, starts getting 
> overtly invasive of the mapped models. Besides which, we are not auto 
> mapping, but rather fluent ClassMap mapping.
>
> Any thoughts how to contend with this?
>
> Thank you!
>
> Best,
>
> 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/e8f15096-6435-4d21-9776-28a93243bdecn%40googlegroups.com.

Reply via email to