如何在C#项目中做其他方式。 [英] How to done other way in C# project.

查看:90
本文介绍了如何在C#项目中做其他方式。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了c#项目。并且ı在任何地方使用sql查询。例如;我想数据库添加数据库和ı使用插入到。我更改数据库列和ı使用update.I定义函数方法和ı完成SQL查询。



但我想要项目中的其他方式。例如实体或其他东西。



你应该以项目的方式做什么?



我尝试过:



公共字符串nnsertstudents()

{

查询=插入ınto....

}

I done c# project. And ı use sql query everywhere.For example; I want to database add database and ı use insert into.I change database column and ı use update.I define function method and ı done sql query.

But I want to other ways in project.For example entity or other things.

What do you should in project way?

What I have tried:

public string ınsertstudents()
{
query= Insert ınto ....
}

推荐答案

您可以使用 ORM (对象关系映射器),微软有实体框架,但这对于一个简单的应用程序可能有点过分。

Dapper 是一个众所周知的简单ORM GitHub - StackExchange / Dapper:Dapper - .Net的简单对象映射器 [ ^ ]

CodeProject也有很多选择:搜索ORM [ ^ ]
You could use an ORM (Object Relational Mapper), Microsoft has the Entity Framework but this might be overkill for a simple application.
Dapper is a well known simple ORM GitHub - StackExchange/Dapper: Dapper - a simple object mapper for .Net[^]
CodeProject has lots of alternatives too: Search for ORM[^]


这篇关于如何在C#项目中做其他方式。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆