sethreno / schemazen

Script and create SQL Server objects quickly
MIT License
332 stars 140 forks source link

.NET Framework Compatibility #204

Closed aboy021 closed 2 years ago

aboy021 commented 2 years ago

Recent releases of SchemaZen only support the most recent versions of dotnet (net5.0;net6.0). I maintain a legacy application that uses the SchemaZen library and it would be great if you supported earlier versions (net48).

I had a look at the source, and the only thing I could find in the Library project that is causing an issue is the use of Convert.ToHexString. I know it's a bit filthy, but there are some code solutions that you could use instead, several of which are listed in this StackOverflow article:

The changes required are small enough, and enough of a matter of taste, that I didn't think a PR request was the right way to raise this.

I fully understand if you want to cut yourself free of older versions of the framework. This is very much a nice to have with a limited shelf life. That said, for my needs having any version of SchemaZen that supports both new and old versions of the framework would be a godsend, even if that support is available in a single release. Framework migration in large solutions can be a troublesome incremental process.

sethreno commented 2 years ago

I'm totally open to a pr for this.

Actually, back a few years when I initially looked at porting to .net core (3.1 at that time) I discovered SoapHexBinary was an issue. (Also, I thought: "ick I don't want soap in the project!") Convert.ToHexString wasn't available at that time and I think I referenced that exact so article and copied the ByteArrayToString function. I abandoned my attempted port as I didn't have time to finish it before @rhumborl submitted a PR porting to net5 (thanks again!).

So yeah, a pr would be great. I can't guarantee support for net48 forever, but don't have immediate plans to use other library functions that are not available there.

aboy021 commented 2 years ago

Support added in #205

aboy021 commented 2 years ago

I've implemented the changes by redirecting the Convert.ToHexString calls to the existing StringUtils class and then using a preprocessor directive to switch between the two implementations.

Thanks for having an editor.config and making the project a welcoming place to contribute. 😄