In class AssemblyTypeSource, use of Assembly.GetTypes is breaking change #185

Open
cbp123 opened this Issue Oct 29, 2012 · 5 comments

Comments

Projects
None yet
3 participants
@cbp123

cbp123 commented Oct 29, 2012

In FluentNH 1.2 and prior the class AssemblyTypeSource implemented the ITypeSource.GetTypes method using Assembly.GetExportedTypes. The new implementation in FluentNH uses Assembly.GetTypes.

GetExportedTypes only requires dependent DLLs to be in the application bin directory when types from that DLL are exposed publicly, where GetTypes requires all dependent DLLs to be in the appication's bin directory, even if they are only used privately.

This change in behaviour can be annoying. I'm not sure if it was intended or if there is a work around.

@chester89

This comment has been minimized.

Show comment
Hide comment
@chester89

chester89 Oct 29, 2012

Collaborator

I think the default behaviour should be GetExportedTypes. And if different behaviour is needed, may be Fluent should provide one or two shortcuts (like GetTypes mentioned above). Any thoughts?

Collaborator

chester89 commented Oct 29, 2012

I think the default behaviour should be GetExportedTypes. And if different behaviour is needed, may be Fluent should provide one or two shortcuts (like GetTypes mentioned above). Any thoughts?

@cbp123

This comment has been minimized.

Show comment
Hide comment
@cbp123

cbp123 Oct 29, 2012

Yes I think .GetTypes would be unusual. Perhaps an overload to the FluentMappings.AddFromAssemblyOf() methods would have been better, e.g. FluentMappings.AddFromAssemblyOf(getNonPublicTypes: true)

cbp123 commented Oct 29, 2012

Yes I think .GetTypes would be unusual. Perhaps an overload to the FluentMappings.AddFromAssemblyOf() methods would have been better, e.g. FluentMappings.AddFromAssemblyOf(getNonPublicTypes: true)

@chester89

This comment has been minimized.

Show comment
Hide comment
@chester89

chester89 Oct 29, 2012

Collaborator

If I'm not too busy this week, I'll do it

Collaborator

chester89 commented Oct 29, 2012

If I'm not too busy this week, I'll do it

@jagregory

This comment has been minimized.

Show comment
Hide comment
@jagregory

jagregory Oct 29, 2012

Collaborator

The change to use GetTypes was deliberate. One of the most common beginner
mistakes was making their mappings private, and them not being picked up by
FNH.

There's also a set of users don't like making their mappings public, and
therefore exposing them as part of the assembly's external API; so
GetExportedTypes wouldn't pick up those mappings, while GetTypes does.

Happy for there to be an overload/switch somewhere though. I'm undecided on
the default though, as the reason for this still stands (users not making
their mapping public).

On Tue, Oct 30, 2012 at 1:19 AM, Gleb Chermennov
notifications@github.comwrote:

If I'm not too busy this week, I'll do it


Reply to this email directly or view it on GitHubhttps://github.com/jagregory/fluent-nhibernate/issues/185#issuecomment-9868323.

James Gregory

Tel: +61 (0) 411 619 513
Website: http://jagregory.com
Twitter: @jagregory http://twitter.com/jagregory

Collaborator

jagregory commented Oct 29, 2012

The change to use GetTypes was deliberate. One of the most common beginner
mistakes was making their mappings private, and them not being picked up by
FNH.

There's also a set of users don't like making their mappings public, and
therefore exposing them as part of the assembly's external API; so
GetExportedTypes wouldn't pick up those mappings, while GetTypes does.

Happy for there to be an overload/switch somewhere though. I'm undecided on
the default though, as the reason for this still stands (users not making
their mapping public).

On Tue, Oct 30, 2012 at 1:19 AM, Gleb Chermennov
notifications@github.comwrote:

If I'm not too busy this week, I'll do it


Reply to this email directly or view it on GitHubhttps://github.com/jagregory/fluent-nhibernate/issues/185#issuecomment-9868323.

James Gregory

Tel: +61 (0) 411 619 513
Website: http://jagregory.com
Twitter: @jagregory http://twitter.com/jagregory

@chester89

This comment has been minimized.

Show comment
Hide comment
@chester89

chester89 Oct 30, 2012

Collaborator

I see. In that case, I think that adding a line in docs will do for now

Collaborator

chester89 commented Oct 30, 2012

I see. In that case, I think that adding a line in docs will do for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment