Entity Framework (EF) Core allows you to define relationships between entities using Fluent API, even without explicitly creating navigation properties. This can be useful when you want to define relationships between entities but don’t want to create navigation properties in your entity classes. Here’s how you can achieve this:
Continue reading “Entity Framework (EF) Core FluentApi Relationships without Navigation Properties”Enabling word wrap for Ionic select component
In Ionic, implementing word wrapping for selectable items within a list or dropdown, commonly referred to as a “select” component, can enhance the user experience and readability. Here’s a general approach to achieving word wrap in an Ionic selectable component:
Continue reading “Enabling word wrap for Ionic select component”Case-insensitive “LIKE” search with EF Core and PostgreSQL
When using EF Core with PostgreSQL for a case-insensitive “LIKE” search, you can leverage PostgreSQL-specific features to achieve the desired behavior. PostgreSQL supports the ILIKE operator, which performs a case-insensitive pattern matching operation. Here’s an example of how to perform a case-insensitive “LIKE” search using EF Core and PostgreSQL:
Helpful C# – Partitioner
In C#, the Partitioner class is part of the System.Collections.Concurrent namespace and is used to partition data into smaller chunks for parallel processing. It provides an easy way to divide work among multiple tasks or threads in a parallel algorithm.
Here’s an example of how to use the Partitioner class:
Helpful C# – OfType
In C#, the OfType method is used to filter a collection and retrieve only the elements that are of a specific type or that can be cast to a particular type. It is part of LINQ (Language-Integrated Query) and can be used with collections that implement the IEnumerable interface.
The syntax for using OfType is as follows:
Angular Material Design Table – Inline Edit Example
First, make sure you have Angular Material installed in your project by running the following command:
ng add @angular/material
Create a component that will house your table and implement inline editing functionality. For example, let’s call it TableComponent:
How to truncate text in an Angular Material UI table cell
Working on a recent project using Angular and Material UI, I needed to be able to truncate the text in one of the cells of a Material table. Here is the simplest way I have found to accomplish that.
//Add this to your css
mat-cell > span.truncate-text {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
//Wrap the long text in a span with a class of truncate-text
<ng-container matColumnDef="longtext">
<mat-header-cell *matHeaderCellDef> LongText </mat-header-cell>
<mat-cell *matCellDef="let element">
<span class="truncate-text">{{element.longtext}}</span>
</mat-cell>
</ng-container>
Workaround – Google Sign-In without Google+ API with MVC .NET and Owin
A few years back I created a small custom application for a client that utilized their Google logins for authentication. The web application was written with ASP.NET MVC and utilized Katana/Owin pipeline. The common practice to setup that application with Google sign in was to also enable the Google+ API. If you have done this then like me you have received an email recently that explains, as of March 2019 the Google+ API’s will be shut down. I have spent the last few days trying to read through the documentation to understand what needs to be done to fix this, without completely switching up the current login flow, however they don’t seem to make this transition easy for .NET applications. Thankfully I finally found the answer I was looking for, a workaround posted in GitHub comments, to address this exact issue. For those of you who are in the same boat as me have a look at this comment . I have made the changes recommended here and I can verify that my Google Sign-In is now working again without the Google+ API enabled.
Advent of Code 2018 – Day 1
In an effort to learn python I am working my way through the Advent of Code challenges. Advent of Code is a coding challenge done during the holiday season every year, its a fun way to keep your skills sharp. It is also a great way to try and learn a new language because it gives you some focused challenges to figure out how the new language works to solve the problem. Check it out here https://adventofcode.com/2018
Continue reading “Advent of Code 2018 – Day 1”Eventstore – Extra Statistics Option on Persistent Subscription – Where is it?
When creating a new persistent subscription in EventStore, there are many options to configure. The extra statistics option was a peculiar one, once enabled there is no indication on what it is doing and where you can see the extra statistics. My previous post about viewing more detailed information on an EventStore persistent subscription likely gave away the answer, the json result of the info link for the persistent subscription has a connections collection. With extra statistics enabled you will see statistics gathered for each connection. Continue reading “Eventstore – Extra Statistics Option on Persistent Subscription – Where is it?”
