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.Data.SqlClient; | |
| class Program | |
| { | |
| static void Main() | |
| { | |
| Console.Title = "Список таблиць БД"; | |
| Console.OutputEncoding = System.Text.Encoding.UTF8; | |
| // MARS - Multiple Active Result Sets !!! MultipleActiveResultSets=True; !!! |
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 EF_Core___Code_First__1_Table | |
| { | |
| public class User | |
| { | |
| public int Id { get; set; } // первинний ключ | |
| public string? Name { get; set; } // інші поля | |
| public int Age { get; set; } | |
| } |
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
| // початкова версія: https://github.com/sunmeat/efcore_codefirst_ensurecreated | |
| // ApplicationDbContext.cs: | |
| using EFCoreCodeFirst.Models; | |
| using Microsoft.EntityFrameworkCore; | |
| using Microsoft.Extensions.Configuration; | |
| namespace EFCoreCodeFirst | |
| { |
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
| AppDbContext.cs: | |
| using EFCoreCodeFirst.Models; | |
| using Microsoft.EntityFrameworkCore; | |
| using Microsoft.Extensions.Configuration; | |
| namespace EFCoreCodeFirst | |
| { | |
| public class AppDbContext : DbContext | |
| { |
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
| AppDbContext.cs: | |
| using EFCoreCodeFirst.Models; | |
| using Microsoft.EntityFrameworkCore; | |
| using Microsoft.Extensions.Configuration; | |
| namespace EFCoreCodeFirst | |
| { | |
| public class AppDbContext : DbContext | |
| { |
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
| ... контекст ... | |
| ... моделі ... | |
| ========================================================================================================= | |
| Repositories / PersonRepository.cs: | |
| public class PersonRepository | |
| { |
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.Xml.Serialization; | |
| using System.Reflection; | |
| public interface IFileHandler | |
| { | |
| void WriteToFile<T>(string filePath, T data); | |
| T ReadFromFile<T>(string filePath); | |
| void UpdateFile<T>(string filePath, T data); | |
| } |
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
| namespace UseDll | |
| { | |
| public class Person | |
| { | |
| public string? Name { get; set; } | |
| public int Age { get; set; } | |
| } | |
| internal class Program | |
| { |
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
| // https://learn.microsoft.com/uk-ua/dotnet/api/system.runtime.loader.assemblyloadcontext?view=net-9.0 | |
| using System.Reflection; | |
| using System.Runtime.InteropServices; | |
| using System.Runtime.Loader; | |
| using System.Text; | |
| namespace UseDll | |
| { | |
| public class Person |
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
| <Project Sdk="Microsoft.NET.Sdk"> | |
| <PropertyGroup> | |
| <TargetFramework>net9.0</TargetFramework> | |
| <ImplicitUsings>enable</ImplicitUsings> | |
| <Nullable>enable</Nullable> | |
| <!-- метадані для NuGet пакету --> | |
| <PackageId>com.sunmeat.mylibrary</PackageId> <!-- тут вкажіть свій УНІКАЛЬНИЙ ID пакету --> | |
| <Version>1.0.0</Version> <!-- вкажіть версію пакету --> |