Skip to content

Migrate to .NET 10 and modernize codebase#4

Merged
xfischer merged 3 commits intomasterfrom
feature/modernize
Feb 5, 2026
Merged

Migrate to .NET 10 and modernize codebase#4
xfischer merged 3 commits intomasterfrom
feature/modernize

Conversation

@xfischer
Copy link
Copy Markdown
Owner

@xfischer xfischer commented Feb 5, 2026

Summary

Migrates Shape2SqlServer from .NET Framework 4.8 to .NET 10 (Windows-only), modernizes the project structure, and enhances the SQL Server connection experience with a custom dialog and SSL certificate configuration.

Key Changes

Project Modernization

  • SDK-style projects: Converted both Shape2SqlServer and Shape2SqlServer.Core to modern SDK-style .csproj format targeting net10.0 and net10.0-windows
  • Cleaned up codebase: Removed dead code, legacy MapBind projects, and unused assemblies
  • Renamed projects: Standardized naming from MapBind.* to Shape2SqlServer.* namespace
  • New solution format: Created modern .slnx solution file

NuGet Package Updates

All packages updated to .NET 10 compatible versions:

  • NetTopologySuite 2.5.0 - Modern spatial geometry library
  • NetTopologySuite.IO.ShapeFile 2.1.0 - Shapefile reading (kept due to API compatibility)
  • NetTopologySuite.IO.SqlServerBytes 2.1.0 - SQL Server spatial type conversion
  • ProjNet 2.1.0 - Coordinate system transformations
  • Microsoft.SqlServer.Types 170.1000.7 - SQL Server spatial types (v2022)
  • Microsoft.Data.SqlClient 5.2.0 - Modern SQL Server client library
  • Azure.Identity 1.17.1 - Azure authentication support

Custom Connection Dialog

Replaced deprecated Microsoft.Data.ConnectionUI (no .NET Core/10 equivalent) with custom frmConnectionDialog:

  • Server and database configuration
  • Windows Authentication / SQL Server Authentication toggle
  • Username and password fields (SQL auth only)
  • Trust Server Certificate checkbox (defaults to checked)
  • Test connection functionality
  • Settings persistence for connection parameters

SSL Certificate Trust Feature

  • Added TrustServerCertificate option to handle modern SQL Server SSL requirements
  • Visible as checkbox in connection dialog
  • Persisted in user settings
  • Prevents certificate chain trust errors when connecting to SQL Server with self-signed certificates

Settings Persistence

Connection dialog settings are now persisted between sessions:

  • sqlServer - Server name/instance
  • sqlDatabase - Database name
  • sqlUseWindowsAuth - Authentication type preference
  • sqlUsername - SQL Server username (password excluded for security)
  • sqlTrustServerCertificate - SSL certificate trust setting

Code Migration Changes

Namespace updates:

  • Replaced GeoAPI.* with NetTopologySuite.Geometries
  • Updated System.Data.SqlClient to Microsoft.Data.SqlClient throughout

API changes:

  • Coordinate system parsing: CoordinateSystemWktReader.Parse()CoordinateSystemFactory().CreateFromWkt()
  • Geometry types: IGeometryGeometry, ICoordinateSystemCoordinateSystem
  • SQL Server writers: MsSql2008GeographyWriter/GeometryWriterSqlServerBytesWriter with SqlGeography/SqlGeometry.Deserialize()
  • Coordinate constructor: 3-parameter → 2-parameter with Z property assignment
  • Exception types: OperationAbortedExceptionSqlException

Native assembly loading:

  • Removed manual SQL Server spatial DLL loading (modern package handles automatically)

Breaking Changes

  • Windows-only: Targets net10.0-windows due to Windows Forms dependency
  • Connection string format: Now uses modern SqlConnectionStringBuilder with TrustServerCertificate support
  • Minimum platform: Requires .NET 10 runtime

Testing Completed

✅ Solution builds successfully
✅ Custom connection dialog displays and functions correctly
✅ Connection string builder includes TrustServerCertificate option
✅ Settings persistence working
✅ Spatial library APIs functioning correctly

Files Changed

  • 93 files changed: 1,245 insertions(+), 6,476 deletions(-)
  • Major additions: frmConnectionDialog.cs (360 lines), updated project files, settings persistence
  • Major deletions: MapBind.* projects, deprecated assemblies, dead code

🤖 Generated with Claude Code

@xfischer xfischer merged commit c8927a5 into master Feb 5, 2026
@xfischer xfischer deleted the feature/modernize branch February 5, 2026 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant