I want create a simple user interface with WPF Core. my goal is to save a few students in my database via the user interface. I have an extra class library for data access. This class contains simple CRUD commands with Dapper Micro ORM. I have a Student Model in my WPF Project. I don't understand how I can get my model into my class library without creating a dependency. I want to initialize my data access class in my MainWindow constructor. So my wpf project needs a reference to my class library. But I need the student model class in my class library to save the results of the queries directly as a student, for example: con.Query < Student> ("SELECT * Students FROM MyDB). I would then have a circle dependency. Have anyone a easy Solution for my Problem?
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
var builder = new ConfigurationBuilder()
.AddJsonFile(System.IO.Path.Combine(Directory.GetCurrentDirectory(), "appsettings.json"));
IConfiguration configuration = builder.Build();
DataAccess dataAccess = new DataAccess(configuration) //<- this class is from my referenced class library
}
}
Aucun commentaire:
Enregistrer un commentaire