Show HN: I built a .NET Core framework and need help

2 points by controlledchaos ↗ HN
Hey All,

I built an open-source .NET Core framework to try and make my job easier when it comes to building REST APIs off of existing databases. I'm looking for tips on how to properly document it, as well as ways to improve the class structure. Any help is appreciated.

https://github.com/evanirla/snacks-entity-core

I have also built a set of extension packages that handle things like Caching and Authorization.

Thanks!

7 comments

[ 3.2 ms ] story [ 33.8 ms ] thread
I took a quick glance of your github codebase, I must say that you are reinventing wheels: for the purpose of Entity Modeling, you can use Entity Framework directly, or similar packages (Dapper, NHibernate...) For general common purpose library, you may refer to a really old library called Enterprise Library for standard .net framework. It provides a lot of common functionalities that can inspire you for build your library in .net core, or you may find someone else have already done one. BTW, this is my first comment ever. I used to programming in C# and .net for 10+ years but for the past 5 years I switch to javascript/typescript on Node.js and python.
Thanks for replying!

To your first point, Dapper is heavily used within this framework. Being able to pass or return models from a query is amazing!

My goal with this was to allow a developer to create their models and be up and running with a RESTful API in hours, without needing to configure each controller route.

You are very welcome. To your goal of allowing devs to set up a RESTful API quickly without configuring controller route, .net core already provides the web api which allows you to hook up with Entity Framework really quickly. IMHO, that paradigm is a very good balance between "quick startup" and "flexible enough for further development". I suggest you to take this approach and try it out, as comparison to your codebase. Hope this help a bit. :)
That looks to be exactly what I need. I had rolled my own solution using Dapper, as Entity Framework scared me off in the past. Seems to have matured a lot since I last used it.
I agree with the points raised by another comment here. It appears you are doing a rewrite of Entity Framework. That said, you may have some specific requirements that justify this approach. Performance would be the most immediate one that comes to mind if you are planning on some domain-specific optimizations.

Regardless, if you are looking for a good way to build documentation, look no further than DocFX:

https://dotnet.github.io/docfx/index.html

This is something that can be built-in to your CI/CD toolchain and automagically refresh your static HTML docs each time you make changes. All of your actual documentation can live in XML comments above the relevant code members throughout. This is intended to work in concert with the default VS comment style (3 slashes starts XML comment section).

I was hoping to avoid using Entity Framework, but maybe I need to give it another go. This library is more around reducing the amount of code needed to build a RESTful API off of an existing database, so maybe I could use parts of EF. DocFX is exactly what I am looking for. Thanks!
After spending a few hours building an API using Entity Framework Core, and then another few trying to get Dapper.Contrib extensions to do what I need it to do without success. I gotta say Entity Framework Core takes the cake.