From 8ef014f939a0a8cf1b40304c10d47b4e5ad1bb02 Mon Sep 17 00:00:00 2001 From: "rongguo.jia" Date: Tue, 6 Dec 2022 08:46:02 +0800 Subject: [PATCH] Init --- .gitignore | 265 ++++++++++++++++++ SyBaseTestWebApp/AppDataConnection.cs | 18 ++ SyBaseTestWebApp/Controllers/Class1.cs | 7 + .../Controllers/WeatherForecastController.cs | 73 +++++ SyBaseTestWebApp/Program.cs | 26 ++ .../Properties/launchSettings.json | 31 ++ SyBaseTestWebApp/Startup.cs | 74 +++++ SyBaseTestWebApp/SyBaseTestWebApp.csproj | 15 + SyBaseTestWebApp/Users.cs | 36 +++ SyBaseTestWebApp/WeatherForecast.cs | 15 + SyBaseTestWebApp/appsettings.Development.json | 9 + SyBaseTestWebApp/appsettings.json | 13 + SyBaseTestWebApp/watchlogs-log.db | Bin 0 -> 180224 bytes SyBaseTestWebApp/watchlogs.db | Bin 0 -> 8192 bytes SybaseTest.sln | 31 ++ SybaseTest/Program.cs | 130 +++++++++ SybaseTest/SybaseTest.csproj | 13 + 17 files changed, 756 insertions(+) create mode 100644 .gitignore create mode 100644 SyBaseTestWebApp/AppDataConnection.cs create mode 100644 SyBaseTestWebApp/Controllers/Class1.cs create mode 100644 SyBaseTestWebApp/Controllers/WeatherForecastController.cs create mode 100644 SyBaseTestWebApp/Program.cs create mode 100644 SyBaseTestWebApp/Properties/launchSettings.json create mode 100644 SyBaseTestWebApp/Startup.cs create mode 100644 SyBaseTestWebApp/SyBaseTestWebApp.csproj create mode 100644 SyBaseTestWebApp/Users.cs create mode 100644 SyBaseTestWebApp/WeatherForecast.cs create mode 100644 SyBaseTestWebApp/appsettings.Development.json create mode 100644 SyBaseTestWebApp/appsettings.json create mode 100644 SyBaseTestWebApp/watchlogs-log.db create mode 100644 SyBaseTestWebApp/watchlogs.db create mode 100644 SybaseTest.sln create mode 100644 SybaseTest/Program.cs create mode 100644 SybaseTest/SybaseTest.csproj diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3e7f6ed --- /dev/null +++ b/.gitignore @@ -0,0 +1,265 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# Auth +src/Win_in.Sfs.Auth.Web/Logs/* +src/Win_in.Sfs.Auth.Web.Host/Logs/* +src/Win_in.Sfs.Auth.IdentityServer/Logs/* +src/Win_in.Sfs.Auth.HttpApi.Host/Logs/* +src/Win_in.Sfs.Auth.HttpApi.HostWithIds/Logs/* +src/Win_in.Sfs.Auth.DbMigrator/Logs/* +src/Win_in.Sfs.Auth.Blazor.Server/Logs/* +src/Win_in.Sfs.Auth.Blazor.Server.Tiered/Logs/* +/WmsService/DataExchange/MesFiles/* +/WmsService/DataExchange/OutputToMes +/WmsService/DataExchange/Output To Mes diff --git a/SyBaseTestWebApp/AppDataConnection.cs b/SyBaseTestWebApp/AppDataConnection.cs new file mode 100644 index 0000000..f00d257 --- /dev/null +++ b/SyBaseTestWebApp/AppDataConnection.cs @@ -0,0 +1,18 @@ +using System; +using LinqToDB; +using LinqToDB.Configuration; +using LinqToDB.Data; +using SyBaseTestWebApp; + +public class AppDataConnection : DataConnection +{ + public AppDataConnection(LinqToDBConnectionOptions options) + : base(options) + { + } + + public ITable Users => this.GetTable(); + + public ITable Part => this.GetTable(); + +} \ No newline at end of file diff --git a/SyBaseTestWebApp/Controllers/Class1.cs b/SyBaseTestWebApp/Controllers/Class1.cs new file mode 100644 index 0000000..920a9de --- /dev/null +++ b/SyBaseTestWebApp/Controllers/Class1.cs @@ -0,0 +1,7 @@ +namespace SyBaseTestWebApp.Controllers +{ + public class Class1 + { + + } +} \ No newline at end of file diff --git a/SyBaseTestWebApp/Controllers/WeatherForecastController.cs b/SyBaseTestWebApp/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..34c9d7c --- /dev/null +++ b/SyBaseTestWebApp/Controllers/WeatherForecastController.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using LinqToDB; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; + +namespace SyBaseTestWebApp.Controllers +{ + [ApiController] + [Route("[controller]")] + public class WeatherForecastController : ControllerBase + { + + private readonly AppDataConnection _connection; + private readonly ILogger _logger; + + public WeatherForecastController( + AppDataConnection connection + ,ILogger logger) + { + _connection = connection; + _logger = logger; + } + + + + [HttpGet] + public Task ListUser() + { + return _connection.Part.ToArrayAsync(); + } + + [HttpGet("{id}")] + public async Task GetUser(int id) + { + + var parts =await _connection.Part.Where(p => p.Id == id).ToListAsync(); + + return parts[0]; + + // return _connection.Part.FirstOrDefaultAsync(person => person.Id == id); + } + + [HttpDelete("{id}")] + public Task DeleteUser(int id) + { + return _connection.Part.Where(person => person.Id == id).DeleteAsync(); + } + + [HttpPut] + public Task UpdateUser(Part person) + { + return _connection.UpdateAsync(person); + } + + [HttpPatch("{id}/new-name")] + public Task UpdateUserName(int id, string newName) + { + return _connection.Part.Where(person => person.Id == id) + .Set(person => person.Name, newName) + .UpdateAsync(); + } + + [HttpPost] + public Task InsertUser(Part person) + { + return _connection.InsertAsync(person); + } + + } +} diff --git a/SyBaseTestWebApp/Program.cs b/SyBaseTestWebApp/Program.cs new file mode 100644 index 0000000..e66c945 --- /dev/null +++ b/SyBaseTestWebApp/Program.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; + +namespace SyBaseTestWebApp +{ + public class Program + { + public static void Main(string[] args) + { + CreateHostBuilder(args).Build().Run(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }); + } +} diff --git a/SyBaseTestWebApp/Properties/launchSettings.json b/SyBaseTestWebApp/Properties/launchSettings.json new file mode 100644 index 0000000..009049b --- /dev/null +++ b/SyBaseTestWebApp/Properties/launchSettings.json @@ -0,0 +1,31 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:14699", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "SyBaseTestWebApp": { + "commandName": "Project", + "dotnetRunMessages": "true", + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/SyBaseTestWebApp/Startup.cs b/SyBaseTestWebApp/Startup.cs new file mode 100644 index 0000000..e23e87a --- /dev/null +++ b/SyBaseTestWebApp/Startup.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using LinqToDB.AspNet; +using LinqToDB.AspNet.Logging; +using LinqToDB.Configuration; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using Microsoft.OpenApi.Models; +using WatchDog; + +namespace SyBaseTestWebApp +{ + public class Startup + { + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + public IConfiguration Configuration { get; } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + services.AddLinqToDBContext((provider, options) => { + options + //will configure the AppDataConnection to use + //sqite with the provided connection string + //there are methods for each supported database + .UseAse(Configuration.GetConnectionString("Default")) + //default logging will log everything using the ILoggerFactory configured in the provider + .UseDefaultLogging(provider); + }); + + services.AddWatchDogServices(); + + services.AddControllers(); + services.AddSwaggerGen(c => + { + c.SwaggerDoc("v1", new OpenApiInfo { Title = "SyBaseTestWebApp", Version = "v1" }); + }); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + app.UseSwagger(); + app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "SyBaseTestWebApp v1")); + } + app.UseWatchDog(opt => + { + opt.WatchPageUsername = "admin"; opt.WatchPagePassword = "Qwerty@123"; + }); + app.UseRouting(); + + app.UseAuthorization(); + + app.UseEndpoints(endpoints => + { + endpoints.MapControllers(); + }); + } + } +} diff --git a/SyBaseTestWebApp/SyBaseTestWebApp.csproj b/SyBaseTestWebApp/SyBaseTestWebApp.csproj new file mode 100644 index 0000000..83c643e --- /dev/null +++ b/SyBaseTestWebApp/SyBaseTestWebApp.csproj @@ -0,0 +1,15 @@ + + + + net5.0 + + + + + + + + + + + diff --git a/SyBaseTestWebApp/Users.cs b/SyBaseTestWebApp/Users.cs new file mode 100644 index 0000000..3e81e8b --- /dev/null +++ b/SyBaseTestWebApp/Users.cs @@ -0,0 +1,36 @@ +using LinqToDB.Mapping; + +namespace SyBaseTestWebApp +{ + public class Users + { + [PrimaryKey] + public int Id { get; set; } + public string Name { get; set; } + public string Dept { get; set; } + + public override string ToString() + { + return $"{Id},{Name},{Dept}"; + } + } + + public class Part + { + [PrimaryKey] + [Identity] + public int Id { get; set; } + public string Code { get; set; } + public string Name { get; set; } + + public override string ToString() + { + return $"Id:{Id},Code:{Code},Name:{Name}"; + } + + public void SetId(int id) + { + Id = id; + } + } +} \ No newline at end of file diff --git a/SyBaseTestWebApp/WeatherForecast.cs b/SyBaseTestWebApp/WeatherForecast.cs new file mode 100644 index 0000000..dc5b858 --- /dev/null +++ b/SyBaseTestWebApp/WeatherForecast.cs @@ -0,0 +1,15 @@ +using System; + +namespace SyBaseTestWebApp +{ + public class WeatherForecast + { + public DateTime Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string Summary { get; set; } + } +} diff --git a/SyBaseTestWebApp/appsettings.Development.json b/SyBaseTestWebApp/appsettings.Development.json new file mode 100644 index 0000000..8983e0f --- /dev/null +++ b/SyBaseTestWebApp/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/SyBaseTestWebApp/appsettings.json b/SyBaseTestWebApp/appsettings.json new file mode 100644 index 0000000..3598694 --- /dev/null +++ b/SyBaseTestWebApp/appsettings.json @@ -0,0 +1,13 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*", + "ConnectionStrings": { + "Default": "Data Source=dev.ccwin-in.com; Port=15000; Database=TYRP; Uid=sa; Pwd=Microsoft2008;Charset=iso_1;" + } +} diff --git a/SyBaseTestWebApp/watchlogs-log.db b/SyBaseTestWebApp/watchlogs-log.db new file mode 100644 index 0000000000000000000000000000000000000000..647e722e599e700dbb2d116d5c4426d6bffc9817 GIT binary patch literal 180224 zcmeI*U2hxNc?a+zCBJPpi8sl%NOW^RYzo^U#d#l&6eE!JX6wziC|R;xV=*F+$gxNc zH8ZqD1>2wqdRd_8MK6-;7QIOtAP5%NPp~%)db4PdPY|F$uy>0BY24?`kTar|lw{Z2 z-Sz%w*EBhE&LR0b!!d_v&hum?Ng8|JTcmH(BPk1XsO9$yXV-qm;A zYIJQtcAW=puNClHUbQRz^SC5E`f<*!=BAWZYz}rlJ{g?!A0mNlhy44li%(x^AjTdF_nys;tX~Z6xLOr2Nd#_Ep)oN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SG_<0uX=z1Rwwb2tWV=5P-lr1SX`t zu?cCJ{>U`5|7-O3$Jq(#Bl`0}b~V$?tY%m|**_U&732SzXarR>FXI0vo9K=h-i!uH z#l~|k)Y!XjReEPq+-9P|)OhSOx_iz>Pz(YPfB*y_009U<00Izz00bZa0SG_<0uX=z W1Rwwb2tWV=5P$##AOL|=1^yQTmabU< literal 0 HcmV?d00001 diff --git a/SyBaseTestWebApp/watchlogs.db b/SyBaseTestWebApp/watchlogs.db new file mode 100644 index 0000000000000000000000000000000000000000..05d7527346893272e8d0101309e74b9d0156df16 GIT binary patch literal 8192 zcmeIuu?>Sj429u`prB4m+Or^N{0HYX8xX v*WZSU00IagfB*srAbUpFfW literal 0 HcmV?d00001 diff --git a/SybaseTest.sln b/SybaseTest.sln new file mode 100644 index 0000000..8a1ef43 --- /dev/null +++ b/SybaseTest.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32922.545 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SybaseTest", "SybaseTest\SybaseTest.csproj", "{000896B3-2A75-4C73-9D53-00AFF85C250A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SyBaseTestWebApp", "SyBaseTestWebApp\SyBaseTestWebApp.csproj", "{13CBB564-B3AC-4801-AE1D-EE87DEFDB4BA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {000896B3-2A75-4C73-9D53-00AFF85C250A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {000896B3-2A75-4C73-9D53-00AFF85C250A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {000896B3-2A75-4C73-9D53-00AFF85C250A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {000896B3-2A75-4C73-9D53-00AFF85C250A}.Release|Any CPU.Build.0 = Release|Any CPU + {13CBB564-B3AC-4801-AE1D-EE87DEFDB4BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {13CBB564-B3AC-4801-AE1D-EE87DEFDB4BA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {13CBB564-B3AC-4801-AE1D-EE87DEFDB4BA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {13CBB564-B3AC-4801-AE1D-EE87DEFDB4BA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {7895A86A-CF05-4A3C-85D6-2250E48A3E25} + EndGlobalSection +EndGlobal diff --git a/SybaseTest/Program.cs b/SybaseTest/Program.cs new file mode 100644 index 0000000..cb0d05a --- /dev/null +++ b/SybaseTest/Program.cs @@ -0,0 +1,130 @@ +using System; +using System.Data; +using System.Linq; +using AdoNetCore.AseClient; +using Dapper; + +namespace SybaseTest +{ + internal class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + + Delete(); + + Add(); + + Query(); + + Update(); + + Query(); + } + + private static void Delete() + { + using (IDbConnection conn = SybaseConn) + { + Users user = new Users + { + Id = 1 + }; + string sqlCommandText = @"DELETE FROM Users WHERE Id=@Id"; + int result = conn.Execute(sqlCommandText, user); + Console.WriteLine(result); + user = new Users + { + Id = 2 + }; + sqlCommandText = @"DELETE FROM Users WHERE Id=@Id"; + result = conn.Execute(sqlCommandText, user); + Console.WriteLine(result); + } + } + + private static void Update() + { + using (IDbConnection conn = SybaseConn) + { + Users user = new Users + { + Id = 1, + Name = "CNKI", + Dept = "HR" + }; + string sqlCommandText = @"UPDATE Users SET Dept=@Dept WHERE Id=@Id"; + int result = conn.Execute(sqlCommandText, user); + Console.WriteLine(result); + } + } + + private static void Query() + { + using (IDbConnection conn = SybaseConn) + { + string sqlCommandText = @"SELECT * FROM Users"; + var users = conn.Query(sqlCommandText).ToList(); + foreach (var user in users) + { + Console.WriteLine(user); + } + + } + } + + + private static void Add() + { + using (IDbConnection conn = SybaseConn) + { + Users user1 = new Users + { + Id = 1, + Name = "CNKI", + Dept = "Sale" + }; + string sqlCommandText = @"INSERT INTO Users(Id,Name,Dept)VALUES(@Id,@Name,@Dept)"; + int result = conn.Execute(sqlCommandText, user1); + Console.WriteLine(result); + Users user2 = new Users + { + Id = 2, + Name = "MSDN", + Dept = "Sale" + }; + sqlCommandText = @"INSERT INTO Users(Id,Name,Dept)VALUES(@Id,@Name,@Dept)"; + result = conn.Execute(sqlCommandText, user2); + Console.WriteLine(result); + } + } + + public static IDbConnection SybaseConn + { + get + { + try + { + return new AseConnection("Data Source=dev.ccwin-in.com; Port=15000; Database=TYRP; Uid=sa; Pwd=Microsoft2008;Charset=iso_1;"); + } + catch (Exception ex) + { + } + return null; + } + } + } + + internal class Users + { + public int Id { get; set; } + public string Name { get; set; } + public string Dept { get; set; } + + public override string ToString() + { + return $"{Id},{Name},{Dept}"; + } + } +} diff --git a/SybaseTest/SybaseTest.csproj b/SybaseTest/SybaseTest.csproj new file mode 100644 index 0000000..0e86272 --- /dev/null +++ b/SybaseTest/SybaseTest.csproj @@ -0,0 +1,13 @@ + + + + Exe + net5.0 + + + + + + + +