Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Articles by Using Microsoft.data. SqlClient
ChatGPT custom GPT and C#
Introduction When displaying an image on a web page, it's recommended that the alt attribute holds a textual replacement for the image. This is mandatory and incredibly useful for accessibility—screen readers read the attribute value out to their users so they know what the image means.
.NET 6 API + Dapper + SQL Server 2014
Zhen (Evan) Wang 于 2024-09-20 17:40:29 发布 阅读量467 收藏 1 点赞数 8 分类专栏: C# SQL 文章标签: c# .net 数据库 版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 C# (.NET 6 API) + Dapper + SQL Server 2014及以上 Packages: <PackageReference Include="Dapper" Version="2.0.143" /> <PackageReference Include="Serilog.Sinks.File" Version="5.0.0" /> <PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.1" /> 创建ISqlConnectionResolver和他的实现类SqlConnectionResolver.cs,此方法用于在.NET6 API 中根据需要访问不通的数据库地址。 using...
Lesson Learned #508: Monitoring Wait Stats and Handling Large Data Set
Sometimes, we get asked how much data the client application is receiving from Azure SQL Database, along with the time spent and the number of rows returned. I would like to share a simple example that allows us to approximate these details. I hope that you could find useful.
Dapper Stored Procedure tip
Introduction Dapper is a simple object mapper for .NET data access which uses Microsoft classes under the covers which has been covered in the following article Using Dapper - C# Part 1 which is part of a series on Dapper. Recently there has been a minor change with working with stored procedures. The former method for calling a stored procedure using Dapper the command type was required as shown below with commandType: CommandType.StoredProcedure.
Lesson Learned #502: Comparing and Transferring Azure SQL Databases Table Structures Using SMO
This last week, I worked on a service request that we need to compare the existing tables of a database placed on a Azure SQL Server with another hand. If the table doesn't exist in the target database the intention is to have a script of the table and recreate the table in the target. Following, I would like to share my lessons learned here.
SQL Server 数据库同步方案(.NET程序实现)
代码片段: 1 using DataSync.Core; 2 using Furion.Logging.Extensions; 3 using Microsoft.Data.SqlClient; 4 using Microsoft.Extensions.Logging; 5 using System.Data; 6 namespace DataSync.Application.DataSync.Services 7 { 8 public class DataSyncServices : IDataSyncData, ITransient 9 { 10 private readonly object lockObj = new object(); 11 /// <summary> 12 /// 客户端向服务端同步 13 /// </summary> 14 /// <param name="clientConn"></param> 15 /// <param name="serviceConn">目标数据库</param> 16 /// <returns></returns> 17...
Lesson Learned #467:Enhancing SQLCMD Script Reliability with C# and JSON
In the dynamic realm of database management, particularly with Azure SQL Database, professionals often encounter unique challenges. One such issue arises while executing scripts using SQLCMD, where prolonged execution of prior commands can lead to disconnections, rendering subsequent commands without an available connection. This article aims to address this challenge by sharing an innovative script that significantly enhances the reliability of script execution.
Lesson Learned #461:Effective Load Balancing in Azure SQL Database: A Practical Approach
In today's data-driven landscape, we are presented with numerous alternatives like Elastic Queries, Data Sync, Geo-Replication, ReadScale, etc., for distributing data across multiple databases. However, in this approach, I'd like to explore a slightly different path: creating two separate databases containing data from the years 2021 and 2022, respectively, and querying them simultaneously to fetch results.
Lesson Learned #457:Optimizing SQL Connection Management with Single Token Authentication
This week, I addressed a service request highlighting a key issue in client applications with varying workloads. We noted that the volume of Azure Managed Identity requests, which fluctuates based on the client's workload and the overall rate of requests received per second, can escalate significantly. This surge in requests often leads to a delay, making the application wait a few seconds before it can successfully request a new token.
Lesson Learned #455:Optimizing Connection Pooling for Application Workloads: Exploring Login Rates
We have a client asking us what the login rate per second is that I can achieve on a S0, S1, S2, and S3 database. It's a complicated question but I'd like to share my experiences using a connection pooler.
Lesson Learned #455:Optimizing Connection Pooling for Application Workloads: Thread Contention
This week, I have been working on a support case where our client experienced a 5-second delay in database connectivity. They were measuring this using StopWatch. As they informed me, they were launching a series of processes, 50-100 concurrent processes to be precise. I would like to share the experience gained in understanding the reasons behind this 5-second delay. The first step is to try to understand how these concurrent processes are launched by adding some logs to the calls.
Lesson Learned #454:Optimizing Connection Pooling for Application Workloads: Active Connections
Actual active connections currently made to servers (100): This indicates the total number of active connections that have been established with the servers at the given timestamp. In this case, there are 100 active connections. Active connections retrieved from the connection pool (92): This shows the number of connections that have been taken from the connection pool and are currently in use. Here, 92 out of the 100 active connections are being used from the pool.
Lesson Learned #453:Optimizing Connection Pooling for Application Workloads: A single journey
In recent days, we have received several requests how to reduce the latency of a connection for an application designed to check database availability for receiving requests. I would like to share with you my experience, along with other articles that will be published shortly Question 2: Why the second and succesive connections took 0 ms? As you could see, we are reusing the previou connection established.
使用asp.net core web api创建web后台,并连接和使用Sql Server数据库
前言:因为要写一个安卓端app,实现从服务器中获取电影数据,所以需要搭建服务端代码,之前学过C#,所以想用C#实现服务器段代码用于测试,本文使用C#语言,使用asp.net core web api组件搭建服务器端,并访问sql server 数据库。 二、 创建ASP.NET Core Web API,选择C#语言。 如下图所示 后面一路默认配置即可,创建后会有个实例代码,个人感觉挺有意义,对于初次使用的人很有参考价值。因为程序中用到图片转base64格式字符串和使用sqlserver数据库,需要下载NuGet程序包,下载方法,解决方案--右键--“管理解决方案的NuGet程序包”,下载如下缺少的包,如下图: 2.安装Nuet程序包——项目——依赖项——管理NuGet程序包(版本等级尽量一样) Microsoft.EntityFrameworkCore Microsoft.EntityFrameworkCore.SqlServer (适用于EF Core SQL Server 提供程序) Microsoft.EntityFrameworkCore.Tools(适用于 EF...
asp.net core mvc Razor +dapper 增删改查,分页(保姆教程)
说明:本demo使用sqlserver数据库,dapper orm框架 完成一张学生信息表的增删改查,前端部分使用的是Razor视图, Linq分页 HtmlHelper。(代码随便写的,具体可以自己优化) //实现效果如下(首页) //新增页 //修改页 //删除 1.使用visual stuido 2022创建 asp.net core mvc项目(选择如下图) 2.安装dapper nuget包(选择第一个) 3.使用sqlserver创建数据库和数据表 USE [stu] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[StuInfo]( [Id] [int] NULL, [Name] [nchar](10) NULL, [Sex] [nchar](10) NULL, [Age] [int] NULL, [BirthDate] [date] NULL ) ON [PRIMARY] GO 4.在项目appsetting中配置数据库连接字符串(填写自己的用户名和密码,和数据库信息)...
使用asp.net core web api创建web后台,并连接和使用Sql Server数据库
前言:因为要写一个安卓端app,实现从服务器中获取电影数据,所以需要搭建服务端代码,之前学过C#,所以想用C#实现服务器段代码用于测试,本文使用C#语言,使用asp.net core web api组件搭建服务器端,并访问sql server 数据库。 一、安装Visual studio 2022 社区版,并安装ASP.NET和Web开发组件。 使用Visual studio installer安装好Visual studio 2022 community版本和asp.net web服务组件。如下图。 二、 创建ASP.NET Core Web API,选择C#语言。 如下图所示。 后面一路默认配置即可,创建后会有个实例代码,个人感觉挺有意义,对于初次使用的人很有参考价值。因为程序中用到图片转base64格式字符串和使用sqlserver数据库,需要下载NuGet程序包,下载方法,解决方案--右键--“管理解决方案的NuGet程序包”,下载如下缺少的包,如下图: 三、连接数据库,并返回查询结果...
SqlDependency in an ASP.NET application - ADO.NET Provider for SQL Server
Read in English Read in English Feedback Edit Twitter LinkedIn Facebook Email Article 11/18/2022 3 minutes to read In this article The example in this section shows how to use SqlDependency indirectly by using the ASP.NET SqlCacheDependency object. The SqlCacheDependency object uses a SqlDependency to listen for notifications and correctly update the cache. Note The sample code assumes that you have enabled query notifications by executing the scripts in Enabling query notifications.
CRUD Operation Using Entity Framework Core
In this article, we are going to discuss the implementation of Web API using entity framework core and stored procedure. Prerequisites .NET Core SDK 6 SQL Server Visual Studio 2022 Agenda Implementation of .NET Core 6 Web API Implementation of stored procedures Implementation of .NET Core 6 Web API Step 1 Create a new .NET Core Web API application. Step 2 Configure the application. Step 3 Provide additional information.
.net core .net6 读取数据库 读取配置文件 保姆级教程
本文环境 Microsoft Visual Studio 2022 .Net6 SQLServer2019 在解决方案管理器右键添加相关的包,如下两个包 Microsoft.Data.SqlClient SQLServer SQLServer数据库 Microsoft.Extensions.Configuration.Json json配置文件 添加配置文件 appsettings.json,选始终复制 添加json配置文件内容如下 { "ConnectionStrings": { "DefaultConnection": "Data Source=.;Initial Catalog=Demo20220707;Integrated Security=true; pooling=false;TrustServerCertificate=true" }, "AppSettings": { "DefaultTable": "UserData2" } } DefaultConnection 根据自己的情况改 创建测试的表与数据,如下图 SQL 语句代码如下 IF EXISTS...
ASP.NET Core Blazor and EF Core Raw SQL queries for Stored Procedure
In this article we will see on how to create an Stored Procedure to search and bind the Customer details in our Blazor application using the EF Core Raw SQL Queries for executing our Stored procedure with search parameter. Download ShanuBlazorRawSQL.zip - 405 KB Introduction In this article we will see in detail on how to use Entity Framework Core Raw SQL for executing Stored Procedures in our ASP.NET Core Blazor Applications.
Show More
loading
Actions
Is this you?
As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.Get in touch with Using Microsoft.data.
Contact Using Microsoft.data., search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack