Rick Strahl's Weblog
Wind, waves, code and everything in between...
Ad-free experience sponsored by:
- the market leader of .NET and Java APIs for file formats – natively work with DOCX, XLSX, PPT, PDF, images and more
WebLog Posts in Category ADO.NET
January, 2021 (2)
November, 2020 (2)
October, 2020 (3)
September, 2020 (2)
August, 2020 (1)
July, 2020 (4)
June, 2020 (3)
May, 2020 (5)
April, 2020 (2)
March, 2020 (3)
February, 2020 (3)
January, 2020 (1)
December, 2019 (2)
ASP.NET Core (53)
Visual Studio (52)
Web Services (19)
.NET Core (18)
Web Api (16)
Sql Server (9)
Microsoft AJAX (8)
West Wind Ajax Toolkit (7)
Web Connection (7)
Entity Framework (6)
Internet Explorer (6)
Html Help Builder (5)
Live Writer (5)
Source Control (4)
Markdown Monster (4)
Help Builder (3)
Web Browser Control (3)
Software Development (3)
Visual Studio Code (2)
ASP.NET vNext (2)
.NET Standard (2)
Visual Studio (1)
ASP.NET Markdown (1)
Control Development (1)
Credit Card Processing (1)
Dynamic Types (1)
VS Code (1)
Web Assembly (1)
Web Deployment Projects (1)
Web Design (1)
Resetting Entity Framework Migrations to a clean Slate
January 13, 2016 - Maui, HI
I've had a number of problems with Entity Framework Migrations getting out of whack to the point were I can't get the database and the migrations into sync to accept new changes. I've found that rather than spending hours fixing out of whack migrations it's sometimes much easier to simply wipe the slate clean and create a new initial migration. This post describes the steps on how to remove existing migrations and create a new initial migration from the current schema.
Basic Spatial Data with SQL Server and Entity Framework 5.0
June 21, 2012 - Hood River, Oregon
Spatial data has been available for a while in SQL Server, but if you wanted to use it with Entiry Framework you had to jump through some hoops. In this post I show how basic SQL Spatial data works and then how you can utilize the new features in EF 5.0 to directly access spatial data using your CodeFirst models.
Creating a Dynamic DataReader for easier Property Access
December 06, 2011 - Maui, Hawaii
Custom dynamic types in .NET are great to wrap other data structures into easier to use and cleaner object.property interfaces. In this post I demonstrate how you can create a dynamic DataReader that allows access to a DataReader's fields using plain object.property syntax.
LINQ to SQL and missing Many to Many EntityRefs
December 24, 2009 - Maui, Hawaii
LINQ to SQL expects every table to be mapped to have primary keys which is reasonable. However, today I ran into a problem with an existing database and a many to many relationship which did not have a Pk in the link table. The model and underlying XML seemed to map this just fine, however, the actual generated code did not approve of this arrangement.
LINQ to SQL and Transactions
July 14, 2009 - Hood River, Oregon
Using explicit Transactions with Linq to Sql is fairly rare but when you need them you'll find that it natively doesn't provide manual transaction management. Rather you have to rely on the TransactionScope class to provide transaction wrapping. Here's a contrived example, and a couple of different transaction scenarios using TransactionScope to manage multiple L2S data operation as a single transaction.
OleDb Parameters to access FoxPro Data from .NET
March 12, 2009 - Maui, Hawaii
OleDb – what a blast from the past. Got a couple of basic questions in the last week on how to access FoxPro data from .NET via OleDb and both questions got tripped up with the parameters query parameter are passed. It’s been so long since I’ve used the OleDb driver I had to look this up again myself to remember how this works through FoxPro OleDb. The issue is that the VFP OleDb driver...
Silverlight and Data Communications
November 20, 2008 - Maui, Hawaii
Silverlight sports a host of 'data access' mechanisms that allow consumption of data from the server. However, if the data is highly dynamic and changeable the combination of a lack of dynamic data retrieval mechanisms, plus use of a static language like C# has made me wonder how to best approach the data access for a very dynamic application.
Dynamic Queries and LINQ Expressions
April 14, 2008 - Portland, Oregon
Using LINQ to SQL in some scenarios where dynamic expresions are required on the right side of a LINQ query expression can be tricky. How do you for example allow a query to use a dynamic field in a query and then query its data? Due to the strong typed nature of LINQ direct LINQ syntax can't be used for this sort of query, but there are a several ways to work around this by using dynamic expressions.
LINQ To SQL and the Web.Config ConnectionString Value
December 07, 2007 - Maui, Hawaii
I just got had by an odd behavior in the LINQ to SQL model designer when working with a LINQ to SQL Model in a separate class library project. I use LINQ to SQL in a business layer which always lives in a separate assembly and so the model does not live in the same project as the Web (or other)...
Complex Detached Entities in LINQ to SQL - more Nightmares
October 01, 2007 - Hood River, Oregon
Ok, so I thought I had the detached entity state in LINQ to SQL figured out, only to have that thrown back into my face. The word from Microsoft is that if you have an entity that was loaded through a LINQ to SQL DataContext at any point it cannot be re-attached to the DataContext.
A simple Business Object wrapper for LINQ to SQL
September 27, 2007 - Hood River, Oregon
I've been talking about how I'm using a small business object wrapper around LINQ to SQL to provide better abstraction of the LINQ to SQL functionality and I suppose the time's come to be bit more specific. This is going to be a long post with a fair bit of code and a brief discussion of the whys and hows...
LINQ to SQL Queries out of a Business Layer
September 26, 2007 - Hood River, Oregon
Using LINQ to SQL for queries out of a business layer has some cool benefits in that core business layer queries returned from business objects can further refine query before the final query operates against the database. This allows the client to perform common formatting like picking which fields to retrieve, changing order or applying a final front end filter on the data. It also allows the client to choose best to represent the query results as an entity list or data reader/data table etc. This entry shows a few ways of how this has advantages and how a business object can greatly facilitate the data serving process.
LINQ to SQL Serialization bites me again
September 21, 2007 - Hood River, Oregon
I'm mucking around with a bit of code today that's using AJAX and returning some data from my business layer that's using LINQ to SQL Entities. I mentioned some time that one issue that I ran into and continue to bump my head against is that LINQ to SQL has big issues serializing its entities. The...
First Impressions on LINQ to SQL
September 11, 2007 - Hood River, Oregon
I've been experimenting with LINQ to SQL for the last few weeks and there's a lot to like as well as a few things to think about. In this editorial I'll describe some of the things that worked well and some of the issues I struggled with and how I worked around them.
LINQ to SQL and Serialization
September 02, 2007 - Hood River, Oregon
LINQ to SQL provides entity objects that can be used easily for object access to data members. But these objects can be difficult to deal with if you need to serialize them in Web Services or in other ways because relationships are often circular. Here's a discussion of things to watch out for and how you can get around the issues.