skip to content
Relatively General .NET

Unity extension for Visual Studio Code – Now Generally Available

by Jb Evain

posted on: March 12, 2024

We are thrilled to announce the general availability of the Unity extension for Visual Studio Code. This extension, built upon the C# Dev Kit and C# extensions, gives you a comprehensive toolkit for your Unity development in Visual Studio Code across Windows, macOS, and Linux.

Understanding System.Diagnostics DiagnosticSource and DiagnosticListener (Part 1)

by Steve Gordon

posted on: March 11, 2024

Throughout its history, .NET has evolved various mechanisms to “log” diagnostic information inside applications and libraries, including TraceSource, EventSource, ILogger, and DiagnosticSource, the subject of this post. TraceSource is a legacy option and is rarely used in new code. ILogger is a simple structured logging abstraction that is well suited to many applications, although it […]

Set a blank page for new tabs in Microsoft Edge

by Gérald Barré

posted on: March 11, 2024

Microsoft Edge can be configured using the setting pages edge://settings. However, some settings are not available in the UI. For instance, you cannot replace the new tab page. You can only configure the content of the page… So, you have to stick with the Edge-like page with news and other stuff yo

Using analyzers in RavenDB indexing

by Oren Eini

posted on: March 08, 2024

We got an interesting question in the RavenDB Discussion:We have Polo (shirts) products. Some customers search for Polo and others search for Polos. The term Polos exists in only a few of the descriptions and marketing info so the results are different.Is there a way to automatically generate singular and plural forms of a term or would I have to explicitly add those?What is actually requested here is to perform a process known as stemming. Turning a word into its root. That is a core concept in full-text search, and RavenDB allows you to make use of that. The idea is that during indexing and queries, RavenDB will transform the search terms into a common stem and search on that. Let’s look at how this works, shall we?The first step is to make an index named Products/Search with the following definition:from p in docs.Products select new { p.Name }That is about as simple an index as you can get, but we still need to configure the indexing of the Name field on the index, like so:You can see that I customized the Name field and marked it for full-text search using the SnowballAnalyzer, which is responsible for properly stemming the terms. However, if you try to create this index, you’ll get an error. By default, RavenDB doesn’t include the SnowballAnalyzer, but that isn’t going to stop us. This is because RavenDB allows users to define custom analyzers.In the database “Settings”, go to “Custom Analyzers”:And there you can  add a new analyzer. You can find the code for the analyzer in question in this Gist link.You can also register analyzers by compiling them and placing the resulting DLLs in the RavenDB binaries directory. I find that having it as a single source file that we push to RavenDB in this manner is far cleaner.Registering the analyzer via source means that you don’t need to worry about versioning, deploying to all the nodes in the cluster, or any such issues. It’s the responsibility of RavenDB to take care of this.I produced the analyzer file by simply concatenating the relevant classes into a single file, basically creating a consolidated version containing everything required. That is usually done for C or C++ projects, but it is very useful in this case as well. Note that the analyzer in question must have a parameterless constructor. In this case, I just selected an English stemmer as the default one.With the analyzer properly registered, we can create the index and start querying on it.As you can see, we are able to find both plural and singular forms of the term we are searching for.To make things even more interesting, this functionality is available with both Lucene and Corax indexes, as Corax is capable of consuming Lucene Analyzers. The idea behind full-text search in RavenDB is that you have a full-blown indexing engine at your fingertips, but none of the complexity involved. At the same time, you can utilize advanced features without needing to move to another solution, everything is in a single box.

RavenDB and Two Factor Authentication

by Oren Eini

posted on: March 06, 2024

RavenDB is typically accessed directly by your application, using an X509 certificate for authentication. The same applies when you are connecting to RavenDB as a user. Many organizations require that user authentication will not use just a single factor (such as a password or a certificate) but multiple. RavenDB now supports the ability to define Two Factor Authentication for access.Here is how this looks like in the RavenDB Studio:You are able to generate a certificate as well as register the Authenticator code in your device. When using the associated certificate, you’ll not be able to access RavenDB. Instead, you’ll get an error message saying that you need to complete the Two Factor Authentication process. Here is what that looks like:Once you complete the two factor authentication process, you can select for how long we’ll allow access with the given certificate and whatever to allow just accesses from the current browser window (because you are accessing it directly) or from any client (you want to access RavenDB from another device or via code).Once the session duration expires, you’ll need to provide the authentication code again, of course. This feature is meant specifically for certificates that are used by people directly. It is not meant for APIs or programmatic access. Those should either have a manual step to allow the certificate or utilize a secrets manager that can have additional steps and validations based on your actual requirements.You can read more about this feature in the feature announcement.

Get Started with Milvus Vector DB in .NET

by Luis Quintanilla

posted on: March 06, 2024

Learn how to get started managing embedding vectors for search and Retrieval Augmented Generation (RAG) scenarios using the Milvus vector database with .NET.