This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- Create EF.Json first | |
| USE [EF.Json] | |
| GO | |
| SET ANSI_NULLS ON | |
| GO | |
| SET QUOTED_IDENTIFIER ON | |
| GO | |
| CREATE TABLE [dbo].[Person]( | |
| [ID] [int] IDENTITY(1,1) NOT NULL, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT SCHEMA_NAME(o.schema_id) AS schema_name, | |
| c.name AS column_name, | |
| OBJECT_NAME(c.object_id) AS table_name, | |
| TYPE_NAME(c.user_type_id) AS data_type, | |
| c.definition | |
| FROM sys.computed_columns c | |
| JOIN sys.objects o | |
| ON o.object_id = c.object_id | |
| ORDER BY schema_name, | |
| table_name, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class DirectoryHelper | |
| { | |
| public static string? UpperFolder(this string? folderName, int level) | |
| { | |
| var folderList = new List<string>(); | |
| while (!string.IsNullOrWhiteSpace(folderName)) | |
| { | |
| var parentFolder = Directory.GetParent(folderName); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary> | |
| /// Provides extension methods for working with <see cref="Control"/> objects, | |
| /// enabling operations such as retrieving descendant controls or specific types of controls | |
| /// within a container like a form, panel, or group box. | |
| /// </summary> | |
| public static class ControlExtensions | |
| { | |
| /// <summary> | |
| /// Base method for obtaining controls on a form or within a container like a panel or group box |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.EntityFrameworkCore; | |
| using Microsoft.EntityFrameworkCore.Infrastructure; | |
| using Microsoft.EntityFrameworkCore.Storage; | |
| /// <summary> | |
| /// Provides helper methods for working with <see cref="DbContext"/> instances in Entity Framework Core. | |
| /// </summary> | |
| /// <remarks> | |
| /// This static class includes extension methods to check the existence of a database and determine |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Text.RegularExpressions; | |
| namespace TODO.Classes; | |
| public partial class Helpers | |
| { | |
| /// <summary> | |
| /// Generates the next value in a sequence by incrementing the numeric portion of the input string. | |
| /// </summary> | |
| /// <param name="sender"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.EntityFrameworkCore; | |
| public static class DbContextExtensions | |
| { | |
| /// <summary> | |
| /// Determines whether the specified entity type has a query filter applied in the current <see cref="DbContext"/>. | |
| /// </summary> | |
| /// <typeparam name="TEntity">The type of the entity to check for a query filter.</typeparam> | |
| /// <param name="context">The <see cref="DbContext"/> instance to inspect.</param> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Runtime.CompilerServices; | |
| using Microsoft.EntityFrameworkCore; | |
| namespace TODO.Classes.Extensions; | |
| /// <summary> | |
| /// Provides extension methods for enhancing and debugging Entity Framework Core queries. | |
| /// </summary> | |
| public static class QueryExtensions | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.EntityFrameworkCore; | |
| namespace NorthWindSqlLiteApp1.Classes.Extensions; // Change to match your project namespace | |
| public static class EntityExtensions | |
| { | |
| /// <summary> | |
| /// Retrieves a list of CLR types representing the entities defined in the model of the specified <see cref="DbContext"/>. | |
| /// </summary> | |
| /// <param name="context"> | |
| /// The <see cref="DbContext"/> instance from which to retrieve the entity types. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class FileHelpers | |
| { | |
| public static (bool isFolder, bool success) IsFileOrFolder(string path) | |
| { | |
| try | |
| { | |
| var attr = File.GetAttributes(path); | |
| return attr.HasFlag(FileAttributes.Directory) ? (true, true)! : (false, true)!; | |
| } | |
| catch (FileNotFoundException) |
NewerOlder