Skip to main content

Posts tagged with 'csadvent'

The Seventh Annual C# Advent

September 12, 2023 mgroves 0 Comments
Tags: csadvent csharp

Short version:

The 2023 C# Advent is now open for contributors to sign up! If you've participated before, I suggest you visit https://csadvent.christmas to claim your spot right away!

Long version:

The C# Advent is an annual event, showcasing content (blog posts, videos, articles, podcast episodes, whatever!) from C# developers and enthusiasts, every day, from December 1st to December 25th.

Each day will feature two pieces of content. Each piece of content links back to the main C# Advent site, like an old fashioned webring.

What do I have to do to participate?

Right now: just sign up. Go to https://csadvent.christmas, look for an open spot, and claim it. You'll receive an email with a special link. Click that link, fill out the form, and you're in! You do NOT need to tell me a title, topic, idea, or anything like that at this stage.

I'll also be adding you to an exclusive mailing list, with reminders, tips, and C# Advent news.

What do I do after I claim a spot?

Work on some content. It must be C# related and it must link back to https://csadvent.christmas, but otherwise, it can be whatever you'd like. Historically, it's mostly blog posts, but there's also been videos and podcast episodes. Any content that can be linked to is fine with me!

Do I give you the content to publish?

No! Publish it on your website, YouTube channel, podcast, whatever. That's the whole point: to help you get attention and noticed by the C# community.

When must I have it finished?

Technically, you don't need to have it done until the day that you claimed. I'd recommend that you get it done before then, because December is a busy holiday time for many of us. Just don't make it public until the day you signed up for.

What does "Advent" mean?

Advent is a season leading up to Christmas Day. Advent Calendars mark the days until Christmas. For children, the marking of each day might include a piece of candy or a small toy.

What are some good examples of C# Advent content?

ANY and ALL content that's related to C# is good in my book. The point is to promote the community, our love of C#, and to lift everyone up! However, if you're looking for some good examples, check out the C# Advent 2022 Awards, to see what was popular.

But remember: you don't have to do anything flashy! If you care about C# and you've got something you want to share, I want you to claim a spot!

How long have you been doing this?

The first C# Advent calendar was in 2017.

You're out of open spots! I missed it!

Maybe not! December can be a hectic month, and sometimes people need to drop out. If you want to be on standby, contact me. Being on standby is one of the hardest jobs, since people may drop out with very little notice. But, if you are up to the task, I very much appreciate it, and I'm willing to accomodate or help you in any way I can.

It's the second annual C# Advent 2022 awards! Every year, you all put out such great stuff. Every post is the best!

But, I wanted to do something to recognize the best of the best: the standouts from the latest Advent that have performed above and beyond, and give everyone a chance to revist them and give the Advent one last "hurrah".

Some of these rewards are based on stats like Google Analytics and Reddit upvotes. Some of them are completely arbitrary. I hope you enjoy!

☝ Most Reddit Upvotes

I make sure all of the articles are submitted to /r/csharp and /r/dotnet (with permission of the respective admins). Here are the posts that got the most (combined) upvotes (as of January 5th, 2022):

1. How To Structure Your .NET Solutions by James Hickey - pulled in over 160 upvotes

2. Building Windows Services in .NET 7 by Kevin Griffin - with over 90 upvotes, I'd say there's life left in Windows development

3. Validating .NET Configuration by Chris Ayers - a cool, unique topic gets over 50 upvotes

🖱 Most Clicks from the C# Advent Site

I use Google Analytics on the site. This award pretty much went to the first three participants this time around. Here are the posts that have been most clicked on from the site.

1. Hello from the GitHub Actions: Core .NET SDK by David Pine

2. Web Scraping and Generating PDFs Using C# and .NET by Christopher C. Johnson

3. Validating .NET Configuration by Chris Ayers

🤓 Matt's Favorite

Every post is great and appreciated, but these in particular stuck out to me as especially interesting, fun, and/or useful. Got favorites of your own? Leave a comment below, tweet #csadvent, and write your own C# Advent Awards blog post (and tell me about it, so I can tweet it and link to it)!

1. Generating C# bindings for native libraries by using ChatGPT - ChatGPT is all the rage, but I think this post shows that ChatGPT can be a very efficient and incredibly useful code generation tool.

2. Colorful ASCII Christmas Tree in C# by ChatGPT - This is a much sillier use of ChatGPT, but I love it because of its silliness AND because of how well it ties into Advent in general. AND it is (partially) a blog post written by ChatGPT too. Extraordinarily creative!

3. Advent of Code 2022 via C# - One of a handful of crossovers between the C# Advent and other advents. This post highlights another great advent and shows off C#.

🐣 Best Newcomer

The best content from someone who has never been on the C# Advent before. The criteria is a combination of all the above.

1. Jonathan "J." Tower - J is a long time C# developer community stalwart, and I'm happy to have him on board the C# Advent for the first time with Top-Level Statements in C#

2. Matthias Jost - Filled in for a dropped day with a great post that everyone can enjoy: How Do I Follow My Favourite .NET Blogs?

3. Brendan Enrick - Another long-time community contributor joins with 11 Ways of Making Your C# Harder to Use

👴 Best Veteran

Same as above, except for those who have posted to the C# Advent before.

1. Matt Eland - Thank you for your TWO contributions this year (one to fill in for a dropped day) - Text Classification in C# with ML.NET 2.0 and Interactive C# with Polyglot Notebooks

2. Jonathan Danylko - Has been a part of C# Advent since the beginning, thank you for Creating Multi-Tier Subscriptions using C#

3. Barret Blake - Another long time Advent contributor brings us Turning Any JSON API Into An App

Honorable Mention to Baskar Rao for being a veteran of every year AND having the most total contributions (seven - he contributed twice in 2017)

Thank you to everyone who participated! I've already started planning enhancements for next year. Be sure to watch mgroves on Twitter, the C# Advent site, and this very blog for announcements when the calendar gets toward the last third.

Thank you Smashing Magazine for featuring the Advent Calendars For Web Designers And Developers (2022 Edition) round-up.

Thank you Sergey Tihon for the inspiration.

A special extra thanks to Calvin Allen, who does a lot of behind-the-scenes work on C# Advent (including the domain name, LinkedIn, the CsAdvent twitter account, testing, and much more) even while juggling the arrival of a new family member. Congratulations and thank you!

This blog post is a part of the 2022 C# Advent. Every day of Advent, two contributions from C# enthusiasts are revealed. Thanks for reading, and Merry Christmas!

I’ve written about How I use Fluent Migrator and Lessons learned about Fluent Migrator. I like using Fluent Migrator when I worked with relational databases.

However, I spend most of my time working with the NoSQL document database Couchbase, these days. If the idea of Fluent Migrator for Couchbase sounds interesting, read on!

What are database migrations?

Database migrations (not to be confused with data migrations) are a series of scripts/definitions that build the structure of a database. For instance, the first script could create 15 tables. The next script might alter a table, or add a 16th table. And so on.

Why are they important?

Having database migrations are important because they make sure anyone interacting with the database is on the same page, whether they’re working on a local database, test database, staging database, production, etc. Migrations can be part of the CI/CD process, as well.

What good is that for NoSQL?

If you’re not familiar with NoSQL, you might think that migrations wouldn’t make any sense. However, NoSQL databases (especially document databases), while flexible, are not devoid of structure. For instance, in place of Database/Schema/Table/Row, Couchbase has the concepts of Bucket/Scope/Collection/Document that roughly correspond.

It’s true that a NoSQL migration would not have as much predefined detail (there’s nowhere to specify column names and data types, for instance), but the benefits of migrations can still help developers working with Couchbase.

Introducing NoSqlMigrator for Couchbase

I’ve created a brand new project called NoSqlMigrator, to offer the same style of migration as Fluent Migrator.

Important notes:

  • This is not a fork or plugin of Fluent Migrator. It’s a completely separate project.

  • This is not an official Couchbase, Inc product. It’s just me creating it as an open source, community project.

  • It’s very much a WIP/alpha release. Please leave suggestions, criticisms, PRs, and issues!

Setting up migrations in C#

The process is very similar to Fluent Migrator.

  1. Create a project that will contain your migration classes (you technically don’t have to, but I recommend it).

  2. Add NoSqlMigrator from NuGet to that project.

  3. Create classes that inherit from Migrate base class. Define an Up and Down. Add a Migration attribute and give it a number (typically sequential).

  4. When you’re ready to run migrations, you can use the CLI migration runner, available as a release on GitHub, or you can use the MigrationRunner class, and run the migrations from whatever code you like. (I recommend the CLI).

Currently, NoSqlMigrator only supports Couchbase. Unlike the relational world, there is a lot of variance in structure and naming in the NoSQL world, so adding support for other NoSQL databases might be awkward (But I won’t rule that out for the far future).

Creating your first migration

Here’s an example of a migration that creates a scope and a collection (a bucket must already exist) when going "Up". When going down, the scope is deleted (along with any collections in it).

[Migration(1)]
public class Migration001_CreateInitialScopeAndCollection : Migrate
{
    public override void Up()
    {
        Create.Scope("myScope")
            .WithCollection("myCollection1");
    }

    public override void Down()
    {
        Delete.Scope("myScope");
    }
}

If you are new to migrations, the Down can sometimes be tricky. Not everything can be neatly "downed". However, I find that I tend to only use Down during development, and rarely does it execute in test/integration/production. But it is possible, so do your best when writing Down, but don’t sweat it if you can’t get it perfect.

Running the migration

Here’s an example of using the command line to run a migration:

> NoSqlMigrator.Runner.exe MyMigrations.dll couchbase://localhost Administrator password myBucketName

That will run all the Up implementations (that haven’t already been run: it keeps track with a special document in Couchbase).

You can also specify a limit (e.g. run all migrations up to/down from #5) and you can specify a direction (up/down). Here’s an example of running Up (explicitly) with a limit of 5:

> NoSqlMigrator.Runner.exe MyMigrations.dll couchbase://localhost Administrator password myBucketName -l 5 -d Up

More features for NoSQL migrations

Here are all the commands currently available:

  • Create.Scope

  • Create.Collection

  • Create.Index

  • Delete.Scope

  • Delete.Collection

  • Delete.FromCollection

  • Delete.Index

  • Insert.IntoCollection

  • Execute.Sql

  • Update.Document

  • Update.Collection

I’m working on a few more, and I have some GitHub issues listing commands that I plan to add. But if you can think of any others, please create an issue!

Tips and Conclusion

Many of the Lessons learned still apply to NoSqlMigrator.

In that post, I mention Octopus, but imagine any CI/CD/deployment tool of your choice in its place (e.g. Jenkins, GitHub Actions, etc).

I think NoSqlMigrator can be a very handy tool for keeping databases in sync with your team, checking knowledge into source control, and providing a quick way to get a minimum database structure built, to make your day of coding a little easier.

Please give it a try in your own project! If you’ve not used Couchbase, check out a free trial of Couchbase Capella DBaaS.

The Sixth Annual C# Advent

October 07, 2022 mgroves 0 Comments
Tags: csadvent csharp

Short version:

The 2022 C# Advent is now open! If you've participated before, I suggest you visit https://csadvent.christmas to claim your spot right away!

Long version:

The C# Advent is an annual event, showcasing content (blog posts, videos, articles, podcast episodes, whatever!) from C# developers and enthusiasts, every day, from December 1st to December 25th.

Each day will feature two pieces of content. Each piece of content links back to the main C# Advent site, kinda like an old fashioned webring.

What do I have to do to participate?

Right now: just sign up. Go to https://csadvent.christmas, look for an open spot, and claim it. You'll receive an email with a special link. Click that link, fill out the form, and you're in! You do NOT need to tell me a title, topic, idea, or anything like that at this stage.

New this year: I'll be adding you to an exclusive mailing list, with reminders, tips, and C# Advent news.

What do I do after I claim a spot?

Work on some content. It must be C# related and it must link back to https://csadvent.christmas, but otherwise, it can be whatever you'd like. Historically, it's mostly blog posts, but there's also been videos and podcast episodes. Any content that can be linked to is fine with me!

Do I give you the content to publish?

No! Publish it on your website, YouTube channel, podcast, whatever. That's the whole point: to help you get attention and noticed by the C# community.

When must I have it finished?

Technically, you don't need to have it done until the day that you claimed. I'd recommend that you get it done before then, because December is a busy holiday time for many of us. Just don't make it public until the day you signed up for.

What does "Advent" mean?

Advent is a season leading up to Christmas Day. Advent Calendars mark the days until Christmas. For children, the marking of each day might include a piece of candy or a small toy.

What are some good examples of C# Advent content?

ANY and ALL content that's related to C# is good in my book. The point is to promote the community, our love of C#, and to lift everyone up! However, if you're looking for some good examples, check out the C# Advent 2021 Awards, to see what was popular.

But remember: you don't have to do anything flashy! If you care about C# and you've got something you want to share, I want you to claim a spot!

How long have you been doing this?

The first C# Advent calendar was in 2017.

You're out of open spots! I missed it!

Maybe not! December can be a hectic month, and sometimes people need to drop out. If you want to be on standby, contact me. Being on standby is one of the hardest jobs, since people may drop out with very little notice. But, if you are up to the task, I very much appreciate it, and I'm willing to accomodate or help you in any way I can.

It's the first ever C# Advent 2021 awards! Every year, you all put out such great stuff. Every post is the best!

But, I wanted to do something to recognize the best of the best: the standouts from the latest Advent that have performed above and beyond, and give everyone a chance to revist them and give the Advent one last "hurrah".

Some of these rewards are based on stats like Google Analytics and Reddit upvotes. Some of them are completely arbitrary. I hope you enjoy!

☝ Most Reddit Upvotes

I make sure all of the articles are submitted to /r/csharp and /r/dotnet (with permission of the respective admins). Here are the posts that got the most (combined) upvotes (as of January 5th, 2022):

1. Don't Do That, Do This: The .NET 6 Edition - Dave Brock killed it with over 300 upvotes

2. String Interpolation Trickery and Magic with C# 10 and .NET 6 - Brant Burnett bringing in around 150 votes

3. Using DateOnly and TimeOnly in .NET 6 to Simplify Your Code - from Christopher C. Johnson, grabbing around 100 votes

🖱 Most Clicks from the C# Advent Site

I put Google Analytics on the C# Advent site for the first time this year. This award will favor the earlier participants, of course. Here are the posts that have been most clicked on from the site.

1. Fastest way to enumerate a List<T> from Gérald Barré got 292 clicks from 272 users

2. The shortest quine in C# 9 and 10 from Martin Zikmund got 276 clicks from 259 users

3. Using C# and Auto ML in ML .NET to Predict Video Game Ratings got 242 clicks from 225 users

🤓 Matt's Favorite

Every post is great and appreciated, but these in particular stuck out to me as especially interesting, fun, and/or useful. Got favorites of your own? Leave a comment below, tweet #csadvent, or write your own C# Advent Awards blog post!

1. Can You Teach C# as a First Language for Kids? - Excellent points made about the strengths and challenges, some great examples and ideas.

2. Fastest way to enumerate a List<T> - Straightforward topic, easy to understand, and introduced me to BenchmarkDotnet!

3. Parallel.ForEachAsync Deep Dive - Again, I was introduced to a tool that I wasn't aware of, and I can potentially make use of.

🐣 Best Newcomer

The best content from someone who has never been on the C# Advent before. The criteria is a combination of all the above.

1. Sarah Dutkiewicz - I can't believe it's Sarah's first time, but she killed it. She claimed day 1, which may be the most challenging day. AND she filled in for someone who dropped out, just two days later. Well done!

2. Matthew MacDonald - My favorite entry this year is from a first-timer.

3. Alvin Ashcraft - Another author who I can't believe is a first-timer! Check out Calling the Microsoft Graph API from WinUI

👴 Best Veteran

Same as above, except for those who have posted to the C# Advent before.

1. Brant Burnett - One of the first to sign up back in 2017, and he has delivered every year since. This year his post was especially popular: String Interpolation Trickery and Magic with C# 10 and .NET 6

2. Ed Charbeneau - Another great post this year. Ed is one of the most enthusiatic participants, and he always creates a great entry: Accessibility Test–Driven Blazor Components

3. Baskar Rao - He is a workhorse when it comes to the C# Advent. A unique topic this year: A Quick Peek of Accessibility Insights and Automating Desktop Applications

Honorable Mention to Roman Stoffel, just because I love the illustrations in Automated Tests Advice, C# Edition

Thank you to everyone who participated! I've already started planning enhancements for next year. Be sure to watch mgroves on Twitter, the C# Advent site, and this very blog for announcements when the calendar gets toward the last third.

Thank you Smashing Magazine for featuring the C# Advent in your Advent Calendars For Web Designers And Developers (December 2021 Edition) round-up.

Thank you Sergey Tihon for the inspiration.

A special extra thanks to Calvin Allen, who does a lot of behind-the-scenes work on C# Advent (including the domain name, LinkedIn, the new CsAdvent twitter account, testing, and much more) AND writes an Advent entry AND deserves accolades for all of it!

Matthew D. Groves

About the Author

Matthew D. Groves lives in Central Ohio. He works remotely, loves to code, and is a Microsoft MVP.

Latest Comments

Twitter