"Phát triển engine vẽ sơ đồ qua code thay vì kéo-thả, dự án có traffic nhưng không thu hút người dùng. Tác giả mời 'mổ xé' MVP của mình. #PhátTriểnPhầnMềm #MVP #Startup #CodeFirst #UXDesign"

https://www.reddit.com/r/SideProject/comments/1qtbe9c/i_hate_draganddrop_tools_so_i_built_a/

Một công cụ ETL/ELT mới tên ETLfunnel vừa được giới thiệu! Được xây dựng bằng Go, ETLfunnel kết hợp cách tiếp cận "code-first" với giao diện trực quan, hỗ trợ triển khai đa máy, xử lý song song và tự host. Tác giả đang tìm kiếm phản hồi từ các chuyên gia dữ liệu về những thách thức hiện tại và tính năng mong muốn.

#ETL #ELT #GoLang #DataEngineering #CodeFirst #VisualTool #KỹSưDữLiệu #PhânTíchDữLiệu #CôngCụDữLiệu

https://www.reddit.com/r/SaaS/comments/1o41mot/built_a_codefirst_visual_etlelt_in_

Why I Read Code, Not Just Docs.

Many ask what books I read to know so much. Truth? I read a lot.

The Key is to read Iterative on usage:
📚 I read & test language updates to stay ahead.
📚 I read JavaDocs from methods to understand my tools.
📚 I dive into source code to see reality.

Marketing slides, old books, outdated websites, foreign benchmarks, YouTube videos, consultants, or sales pitches, code doesn't tell you everything.

That's how I spot:
❌ Frameworks abusing ThreadLocals, reflection, synchronised.
❌ "GraalVM-ready" still needing class loading & build on runtime.
❌ Cloud SDK packed with 300+ dependencies.
❌ Memory leaks, vulnerabilities & hidden bloat.
[...]

AI won't save us, it'll just continue the trend.

#DevLife #CodeFirst #Engineering #TechDebt #Resilience #Reliability #Reusability #SoftwareEngineering #DevOps #CleanCode #programmer #code

I just implemented the Code First Generic Repository Pattern in C#! Say goodbye to repetitive repository code 👋 Check out my implementation and let me know your thoughts! #CSharp #RepositoryPattern #CodeFirst #UnitofWork

http://vyechi.com/2024/08/20/generic-repository-pattern-in-c/

Generic Repository Pattern in C#

Have you ever dreaded writing the same boilerplate repository code repeatedly? You’re not alone; I will share my implementation of the Code First Generic Repository Pattern in C#. I will only…

Vyechi

Have you ever dreaded writing the same boilerplate repository code repeatedly? You’re not alone; I will share my implementation of the Code First Generic Repository Pattern in C#. I will only include some of the code because it will make the post incredibly long. At the end of the post, I will share a Goal donation to post a Git download link so you can take it for a spin. As a bonus, the repository uses Code First and Unit of Work.

Generic Repository Pattern in C#

Let’s begin with the Entity interface. The IEntity interface is a typical pattern used in software development to define a contract for entities, typically in the context of data access and persistence. It usually includes a property for the entity’s unique identifier. The Generic Type: The IEntity interface uses a generic type parameter TKey to allow flexibility in the type of the identifier (e.g., int, Guid, string). The ID property will identify each entity uniquely. Feel free to read more about the implementation at the entity framework core generic repository and Structured Query IEntity.

public interface IEntity<TKey>{ TKey Id { get; set; }}

You might find the following definition of the generic repository pattern on the interwebs.

The Generic Repository pattern in C# is a design pattern that abstracts the application’s data layer, making it easier to manage data access logic across different data sources. It aims to reduce redundancy by implementing typical data operations in a single, generic repository rather than having separate repositories for each entity type.

public interface IGenericRepository<TEntity, TKey> where TEntity : class, IEntity<TKey>{ void Delete(TEntity entityToDelete); TEntity? GetFirstOrDefault(Expression<Func<TEntity, bool>> predicate); void Update(TEntity entityToUpdate); void Save(); void Dispose();}

The interface header has two generic types. TEntity is the domain class, and the TKey is the ID type, int, or string. Note that IEntity abstracts away the type TKey. It looks complex for the moment, but you will see benefits later.

Moving away from the Generic Repository, let’s focus on the pattern of the Unit of Work. According to Copilot:

The Unit of Work is a design pattern used in software development to manage and coordinate changes to a database. It ensures that all operations within a single business transaction are treated as a single unit, which means they either all succeed, or all fail together. This helps maintain data integrity and consistency.

Implementing the Repository and Unit of Work Patterns in an ASP.NET MVC Application (9 of 10) | Microsoft Learn

https://code-maze.com/csharp-unit-of-work-pattern/

public interface IUnitOfWork : IDisposable{ IGenericRepository<TEntity, TKey> Repository<TEntity, TKey>() where TEntity : class, IEntity<TKey>; void Save(); Task<int> SaveAsync();}

The Unit of Work will allow us later to inject it as a service for any repository. If you inspect the interface closely, you will notice it has three fields. The most vital of the three is the Repository. The method returns a domain of type repository and key. You can specify the type when using it.

Moving on to the Code First portion, we must tell Entity Framework how to build our database. To do so, we can create a “BloggingContext”.

public class BloggingContext: DbContext{ // Use design time factory public BloggingContext(DbContextOptions<BloggingContext> dbContextOptions) : base(dbContextOptions) { } public DbSet<Blog> Blogs { get; set; } public DbSet<Post> Posts { get; set; }}

If you inspect the code closely, you will notice that we inherited from DbContext, which allows us to manipulate the database. The DbContext will also enable us to use DbSets and CRUD methods. You can read more about DbContext Class on the Microsoft website.

Before using your Database Context with Code, you must set up migrations. Migrations allow you to evolve your database as you code and change the schema. I recommend you read up on Migrations managing schemas because it has excellent examples to help you start quickly.

At the high level, in Visual Studio, open up the Tools menu, then the NuGet Package Manager menu, followed by the Console. In the Console, you must install the following package.

Install-Package Microsoft.EntityFrameworkCore.Tools

The Microsoft.EntityFrameworkCore.Tools will allow you to make the following commands.

Add-Migration InitialCreate

Update-Database

Meanwhile, you might want to consider making a DesignTimeDbContextFactory because it aids in setting up the connection string for the database.

public class DesignTimeDbContextFactory : IDesignTimeDbContextFactory<BloggingContext>{ public BloggingContext CreateDbContext(string[] args) { // Build configuration IConfigurationRoot configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.Development.json") .Build(); // Get connection string var connectionString = configuration.GetConnectionString("DefaultConnection"); var optionsBuilder = new DbContextOptionsBuilder<BloggingContext>(); optionsBuilder.UseSqlServer(connectionString); return new BloggingContext(optionsBuilder.Options); }}

I’m considering publishing the fully working example on Git with the following components.

  • Services
  • Domain
  • Interfaces
  • Repository
  • Console App with basic CRUD operations
  • Dependency Injection

Current Donation Amount

$2.41 – PayPal fees 🤑

Note that the donation amount is being updated manually on my end. I have asked WordPress; see the image for details. I will list your name and last name initials. If you like the website backlink, donate $10 or more, and let me know in the comments your web address.

Donate to Goal of $666 to unlock Code First Generic Repository Pattern 🚀✨

Upon reaching the $666 Goal, I will share the code.

$3.00

Click here to purchase.

Donators List

  • Nicholas S 8.20.2024

https://vyechi.com/2024/08/20/generic-repository-pattern-in-c/

#CodeEfficiency #CodeFirst #CRUDOperations #CSharp #DatabaseManagement #DbContext #DependencyInjection #DesignPatterns #EntityFramework #GenericRepository #Migrations #RepositoryPattern #SoftwareDevelopment #UnitofWork

Code First to a New Database - EF6

Code First to a New Database in Entity Framework 6

Well as I mentioned, here's the first release candidate, if you're interested in trying out a web-like inspired router for Avalonia, check out Navs: https://github.com/AngelMunoz/Navs/releases/tag/v1.0.0-rc-001
I don't plan into adding more features to this release as I think it does what it should, I can for sure respond to feedback and add a couple more features that are not breaking changes before I run out of adhd gas though
😆 so be sure to give feedback during April!

#dotnet #fsharp #avalonia #router #codefirst #buildintheopen #softwaredev
Release v1.0.0-rc-001 · AngelMunoz/Navs

What's Changed Nothing too crazy Navs.Avalonia: Feat: Add Double Way Binding for Changeable Values (#11) Docs: add CVal to Navs-Avalonia.md Full Changelog: v1.0.0-beta-008...v1.0.0-rc-001

GitHub

New MicroProfile OpenAPI #blogpost: second installment in the series, this one about the design-first approach,
using #swagger-codegen and #openapi-generator:

https://pesche.schlau.ch/2024/03/27/microprofile-openapi-design-first/

#TechAtWorldline #java #quarkus #microprofile #openapi #opensource #codefirst #designfirst
@quarkusio

MicroProfile OpenAPI—Design First

You’re given the task of writing a microservice AND providing a documentation in OpenAPI format. You already know that there are two main approaches: code-first : write the code, using OpenAPI annotations, and then generate the OpenAPI document design-first : write the OpenAPI document (a.k.a. the openapi.yaml file) and then generate the code This is the second article in a series and reviews the design-first approach, the code-first approach was the subject of the first article.

Pesches Schlauch

MicroProfile OpenAPI: review of using the the code-first approach with Quarkus (the design-first approach will follow in a separate installment).

New #blogpost: https://pesche.schlau.ch/2023/12/01/microprofile-openapi-code-first/

#TechAtWorldline #java #quarkus #microprofile #openapi #opensource #codefirst #designfirst
@quarkusio

MicroProfile OpenAPI—Code First

You’re given the task of writing a microservice AND providing a documentation in OpenAPI format. You already know that there are two main approaches: code-first : write the code, using OpenAPI annotations, and then generate the OpenAPI document design-first : write the OpenAPI document (a.k.a. the openapi.yaml file) and then generate the code This article reviews the code first approach, the design-first approach will follow in a second article at a later time.

Pesches Schlauch
Learn about Eclipse Chariott’s massage seat use case with Sören Frey and Lauren Datz in the first episode of Shifting Gears with #SDV https://hubs.la/Q01-JnYk0 #opensource #SoftwareDefinedVehicle #codefirst
Let Eclipse Chariott Massage You While Driving - Shifting Gears with SDV

YouTube
1 WEEK until Sören Frey and Lauren Datz’s live presentation on Eclipse Chariott’s massage seat use case'. Register here: https://hubs.la/Q01S-7cg0 #opensource #drivenbycode #SoftwareDefinedVehicle #SDV #codefirst
Let Eclipse Chariott Massage You While Driving - Crowdcast

Register now for Eclipse Foundation's event on Crowdcast, scheduled to go live on Thursday June 22, 2023 at 10:00 am EDT.

Crowdcast