Dixin's Blog
Microsoft Most Valuable Professional (CodingOnWheels.com) & Photographer (PicturesOnWheels.com). Code examples: GitHub.com/Dixin/Blog.
-
Entity Framework and LINQ to Entities (3) Logging
As fore mentioned, this tutorial will use SQL Profiler to trace the remote SQL queries, which are translated from the LINQ to Entities queries. This is most close the the truth, because the tracing uncovers the actual SQL query executed in SQL database. Entity Framework also provides several options to log the translated SQL database operations programmatically.
-
Use Fiddler with Node.js
Fiddler is an useful HTTP proxy debugger on Windows. It would be nice if it can work with Node.js applications. To do this, just need to proxy Node.js requests through Fiddler. The default proxy is 127.0.0.1:8888. This can be viewed in Fiddler Tools –> WInINET Options –> LAN settings –> Advanced:
-
Entity Framework and LINQ to Entities (5) Query Translation
The previous part discussed what SQL queries are the LINQ to Entities queries translated to. This part discusses how the LINQ to Entities queries are translated to SQL queries. As fore mentioned, IQueryable<T> query methods work with expression trees. Internally, these methods build expression trees too, then these expression trees are translated. In Entity Framework, .NET expression tree is not directly translated to SQL query. As mentioned at the beginning of this chapter, Entity Framework implements a provider model to work with different kinds of databases like Oracle, MySQL, PostgreSQL, etc., and different database system can have different query languages. So Entity Framework breaks the translation into 2 parts:
-
Entity Framework and LINQ to Entities (2) Object-Relational Mapping
.NET and SQL database and have 2 different data type systems. For example:
-
Entity Framework and LINQ to Entities (10) Performance
The previous parts has discussed a few aspects that can impact the performance of Entity Framework and LINQ to Entities, and here is a summary:
-
Visual Studio Entity Data Model Wizard Not Responding
This post is for the issue that Entity Data Model Wizard becomes not responding. In Visual Studio 2015, when clicking the Finish button to create the entity data model from SQL Server 2014 SP! database, the wizard is frozen:
-
Entity Framework and LINQ to Entities (9) Optimistic Concurrency
Conflicts can occur if the same piece of data is read and changed concurrently. Generally, there are 2 concurrency control approaches:
-
Entity Framework and LINQ to Entities (8) Transactions
As discussed above, by default DbContext.SaveChanges execute all data creation, update and deletion in a transaction, so that all the work can succeed or fail as a unit. The following example tries to update 2 entities, so there will be 2 UPDATE statements in the transaction:
-
Understanding C# Features (8) Covariance and Contravariance
[LINQ via C#] - [C# Features]
-
Sync Windows Live Writer Drafts and Posts Across PCs
Windows Live Writer saves drafts and posts under Documents\My Weblog Posts. To sync this directory with OneDrive, just move it to OneDrive (e.g. OneDrive\Documents\WindowsLiveWriter), and create a junction to redirect:
-
C# 6.0 String Interpolation, FormattableString, and Code Analysis CA1305: Specify IFormatProvider
C# 6.0 introduces a syntactic sugar string interpolation, it is safer and more readable than composite formatting. Here is a small example:
-
DiskPart Problem: Cannot Select Partition
When working with USB drive, the DiskPart command cannot select the partition of the USB disk:
-
Understanding C# Features (7) Higher-Order Function
[LINQ via C#] - [C# Features]
-
Understanding C# Features (6) Closure
[LINQ via C#] - [C# Features]
-
Entity Framework and LINQ to Entities (1) IQueryable<T> and Remote Query
The previous chapters discussed LINQ to Objects, LINQ to XML (objects), and Parallel LINQ (to Objects). All of these APIs query in memory objects managed by .NET. This chapter discusses Entity Framework, a Microsoft library providing a different kind of LINQ technology, LINQ to Entities. LINQ to Entities can access and query relational data managed by different kinds of databases, e.g.:
-
End-to-end: Setup continuous integration/continuous delivery for ASP.NET Core + SQL database with GitHub, AppVeyor and Azure
I have a web project “Chinese Etymology (http://hanziyuan.net)” for searching Chinese character’s etymologies and ancient Chinese characters. It is developed with Microsoft tech stack – ASP.NET Core + SQL database. It is open source on GitHub. Its database is deployed to Azure SQL Database, and the website is deployed to Azure App Service. I will use this project to demonstrate the end-to-end workflow and setup for continuous integration/continuous delivery with AppVeyor. After these steps, when you commit code and push to your repository
-
Easy Ways to Test SQL Server/SQL Azure Connection
It is incredibly easy to test the SQL Server/Azure SQL Database connectivity or firewall settings from Windows, even without SSMS (SQL Server Management Studio) or coding.
-
Detect Chinese Character in Unicode String
Recently, when trying to convert some directory/file names between Chinese and English, it is necessary to detect if a Unicode string contains Chinese characters. Unfortunately, Chinese language detection, or language detection, is not easy. There are several options:
-
Entity Framework and LINQ to Entities (7) Data Changes
Besides LINQ to Entities queries, Entity Framework also provides rich APIs for data changes.
-
Installing Android 6 Marshmallow on Nexus 7
I got a Nexus 7 in 2013. In 2014 it was upgraded to Android 5.0 Lollipop, and then became way slower. This month, Google released Android 6.0.0 factory images - build MRA58K, Nexus 7 2013 included. So maybe it is time to refresh the device.
Here are the steps of installing from Windows 10: