andrewabest / Conventional

A suite of convention specifications for enforcing type and style conventions in your codebase
Microsoft Public License
97 stars 29 forks source link

Added "Files must be embedded resources" convention #15

Closed michael-wolfenden closed 9 years ago

andrewabest commented 9 years ago

Love your work @michael-wolfenden

I find this convention interesting as it sort of falls between 'solution' and 'assembly' conventions. Makes me wonder if an AllAssemblies type class that allowed you to execute a composite assembly specification would be on the cards at some point, similar to what is currently done when working with types. It would save you having to dig for the project files, but aside from that it would be fairly similar in implementation.

Not interested in pursuing it until someone asks for it though :)

michael-wolfenden commented 9 years ago

Argh.... I wanted the see what the message would look like when a bunch of files failed.. Hopefully all good now.

michael-wolfenden commented 9 years ago

Sorry.. I didn't even see the assembly conventions.. I think it makes more sense as an assembly convention, especially if I can access the files in a strongly typed manner rather than regex.. Happy to port it over.. Your call.

andrewabest commented 9 years ago

There really isn't a huge difference in between what you are doing now and what the assembly conventions do. They simply load the assembly based on a name match or based on the assembly name attributed to a type into an XDocument and then turn that into an expando, so it ends up dynamically typed anyway. I don't really have a compelling reason yet to build a strongly typed structure to reflect the proj files internals.

Happy for this one to stay as it is at the moment, may revisit it when I get around to implementing the composite assembly conventions.

andrewabest commented 9 years ago

I'll merge this once you confirm your either happy with leaving it as is, or feel strongly enough about porting it that your willing to build out the composite assembly convention structure (I don't have time at the moment sorry).

To confirm - in your use case, are you purposefully targeting all projects in the solution with this? Or is it only a single project that requires the embedded resources? If the latter, perhaps an assembly convention would make more sense.

michael-wolfenden commented 9 years ago

Thinking about it some more, checking this at a solution level might be over-reaching. I think the main use case for this (at least for me) is for sql migration scripts (a-la DbUp) and realistically these would probably be defined within a single assembly. I will port to an assembly convention but probably leave out the composite until it's needed. Agreed?

andrewabest commented 9 years ago

Sounds entirely sensible @michael-wolfenden, and I imagine this would be the primary use case. I'll wait on the assembly convention then :+1: