Dotnet interactive as a rails-console replacement csharp
The tool I miss most when not using ruby-on-rails (which I use at my day-job) is the rails console.
My main use for the console is to write queries in the same ORM language as the rest of my application.
For example, I might drop into the rails console to see the raw output of a query like Course.where('start_date < DateTime.now - 1.year')
.
Or, if I need to create some fake data, I could drop into another console and run something like Course.last.update(start_date: DateTime.now - 2.year)
.
Both of these would be easy enough to do in SQL, but I find it more convenient to use the application’s ORM and have access to any helper functions that I’ve already written.
Recently, I’ve tried to approximate this workflow using dotnet interactive, and I’ll describe that setup below. The finished result can be found here(github).
Experiments & Architectural Process architecture
It sometimes takes working on an application with a bad architectural design to realize that you never want to work on such a project again. But, how does a programmer make sure their application doesn’t become that project?
Configure Await csharp
Reading through a asp.net core project, I came across number of calls that looked like this:
int affectedRows = await this._context
.SaveChangesAsync()
.ConfigureAwait(false); // ME: what does this do?
return affectedRows;
I dug into what this was actually doing by reading this blog:
await
uses a custom callback strategy based on the calling contextConfigureAwait(false)
ignores the custom strategy.
Ubiquitious Language - 'Software Architect's Handbook' architecture
Ubiquitous Language and the imortance of just agreeing on what to call things.
Dotnet query console csharp
As I’ve developed with Rails, the feature I’ve come to appreciate the most is the rails console
.
It gives you an immediately connected view into your application - fully hooked up to all of your code and to your database.