Applied partial to all Dapper classes and interfaces in order to improve extensibility #54

Merged
merged 1 commit into from Oct 8, 2012

Conversation

Projects
None yet
3 participants
Contributor

mrange commented Oct 6, 2012

Hi, in order to improve the experience for developers (like me) that reference Dapper by source (ie add as link or similar, to me this is a great feature of Dapper) I made all dapper classes and interfaces partial.

In addition the public property of Dapper classes are moved to separate partial classes, this will allow developers that reference by source to privatize the dapper symbol to avoid ambigiousness if several projects are included which uses Dapper in this way.

I believe these changes to be safe as they only affect the compile behavior.

Best regards mrange

@mrange mrange Made Dapper classes partial in order to allow developers that reference
Dapper by source to extend the Dapper classes without making changes to
the Dapper source (for instance in order to expand DynamicParameter with
a method HasValue<T>(string name)). In addition to further help developers
that reference Dapper by source the public property of Dapper classes are
moved to separate partial classes. By default the previous behavior is kept
but when referencing by source you can now make the Dapper classes internal
by defining: DAPPER_MAKE_PRIVATE
8ec13e1
Contributor

SamSaffron commented Oct 7, 2012

seems fine to me, will let @mgravell merge it in once he eyeballs it

Contributor

mrange commented Oct 7, 2012

Thanks, this is an important addition for developers like me that like to reference Dapper by source.

Contributor

mgravell commented Oct 8, 2012

It looks like it'll do the job, but I check what the main driver is here? is it simply: so it can be made "internal" ? I guess it shouldn't adversely impact anything, though...

@mgravell mgravell added a commit that referenced this pull request Oct 8, 2012

@mgravell mgravell Merge pull request #54 from mrange/master
Applied partial to all Dapper classes and interfaces in order to improve extensibility
4fb305b

@mgravell mgravell merged commit 4fb305b into StackExchange:master Oct 8, 2012

Contributor

mrange commented Oct 8, 2012

It’s actually two Changes in one pull request:

Make classes partial in order to enable developers (like me) that use reference by source to add to the Dapper classes without modifying the source. For instance I can add a HasValue to DynamicDictionary without modifying the dapper source. I can’t implement the method with inheritance as it requires private data in the DynamicDictionary.
Make it possible to internalize Dapper classes, once again for developers that like to reference Dapper by source. The problem of having them public in that case is that an assembly A consumes assembly B,C. Imagine B,C uses Dapper reference by source. Compiling assembly A can now be problematic because of type ambigiousness.

For me a great feature of Dapper is that I can reference it by source and internalize Dapper in my assemblies. Making Dapper partial and hide the classes (to avoid ambigiousness) will make it even more useful to me.

Mårten

Från: Marc Gravell
Skickat: ‎den ‎8‎ ‎oktober‎ ‎2012 ‎09‎:‎12
Till: SamSaffron/dapper-dot-net
Kopia: mrange
Ämne: Re: [dapper-dot-net] Applied partial to all Dapper classes and interfaces in order to improve extensibility (#54)

It looks like it'll do the job, but I check what the main driver is here? is it simply: so it can be made "internal" ? I guess it shouldn't adversely impact anything, though...


Reply to this email directly or view it on GitHub.

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