LINQ to SQL in Visual Studio 2005 - linq

I normally run VS 2008 at home and LINQ is built in. At work we are still using VS 2005 and I have the opportunity to start a new project that I would like to use LINQ to SQL.
After doing some searching all I could come up with was the MAY 2006 CTP of LINQ would have to be installed for LINQ to work in VS 2005.
Does someone know the proper add ins or updates I would need to install to use LINQ in VS 2005 (preferably without having to use the CTP mentioned above).

You can reference System.Data.Linq.dll and System.Core.dll, and set your build target for C# 3.0 or the latest VB compiler, but everything else would have to be mapped manually (no designer support in VS2005 in LINQ to SQL RTM).

It's no longer legal to use the May CTP (the beta software).
It's not legal to deploy System.Core.dll (among others) without installing .Net 3.5
The best way to do LINQ in VS2005 is to use LINQBridge for LinqToObjects, and to use simple table adapters or some other data access method to punt your data into objects (for further in-memory querying).
Also note: LinqToObjects expects Func(T) - which are essentially delegate types. LinqToSQL requires Expression(Func(T)) - which are expression trees and much harder to construct without the lambda syntax.

Related

UWP database designer for SQLite

I am following this tutorial and it seems you have to build all the relationships manually.
Is there any database visualizer/designer for visual studio which will help you to easily create an SQLite database?
Something like this one:
TL;DR: Currently there's no official support in UWP to create your database from a designer AND have both the SQL and C# code generated.
If you're using EF Core with code first as done in the tutorial you're following, then there's no designer to help. After all it is 'code first' not designer first.
If you really want to design your database, you can use ErikEJ's Visual Studio Extension called SQLite / SQL Server Compact Toolbox . This will help you to design the database, but then you won't have a way to generate the C# DBContext and Entity classes for UWP, as UWP only supports EF Core (not EF 6).
So you'll either have to write the models yourself after designing the database and you're back at step 1 (so what's the use of using a visual designer), or write SQL queries yourself using SQLite.NET-PCL or any other SQLite NuGet package.

c# null conditional member access operators

We've recently received a project that was started using Visual Studio 2015. In the code there were places where developers used
null conditional member access
operator. We are using Visual Studio 2013 and the code does not compile I've read the documentation from msdn (https://msdn.microsoft.com/en-us/library/6a71f45d(v=vs.140).aspx) and it states that this operator is not available with Visual Studio 2013. What's the logic behind this decision? The c# syntax depends on IDE? Shouldn't this be fixed for the same .net version?
This is simply a matter of what is available to use with different versions of C# and VS.
This is not a bug. Clearly that solution is making use of the latest tooling and version c# available, you are not. The same applies if you where only using .net 2.0, you wouldn't be able to use Linq. Thus you have to accommodate it in some way
With VS 2013, it comes with .net 4.5.1 and C# 5, you can
Either install .net framework 4.6 and C#6 , then just update the targeted framework version in your projects
or use VS2015, then just update the targeted framework version in your projects
or laboriously reverse that syntax sugar back like the following:
someObject?.PossiblySafeProperty?.LessSafeNestedProperty
//to
string valueYouWant = null;
if(someObject != null && someObject.PossiblySafeProperty!=null)
{
valueYouWant = someObject.PossiblySafeProperty.LessSafeNestedProperty;
}
As far as what the IDE can interpret yes, C# 6 syntax is only available in VS2015. However, using the latest compiler will fix your build errors(albeit not showing up correct in the IDE). And the .Net version has nothing to do with the languages syntax, only the libraries you can use in it. The logic behind the decision? To get you to upgrade to a newer product, same as offering Windows 10 for free. Microsoft wants you using the "latest and greatest" they have to offer.

Set entity framework DDL generation language

I am using Entity Framework with Visual Studio 2012 or 2010. I am working together with colleagues who have a different language version (German) of Visual Studio installed.
Some of our models use inheritance. When generating the database from the model (using standard values: TablePerTypeStrategy.xaml and SSDLToSQL10.tt) EF generates inheritance constraints. The names of these constraints are localized (x_inherits_y vs x_erbt_y). This means, every time someone makes a change to the model and generates the SQL file all the constraint names are updated with the localized version.
This is starting to become a major annoyance as we need to know the names of the constraints. Sometimes we need to update already deployed databases and there is no way to know whether they have been created with the German or English constraint names. This makes writing update scripts impossible without access to the database.
Is there some way to prevent Visual Studio from localizing these names other than force all developers to use the same Language version?

Table Valued Functions in EDMX with Entity Framework 5 / Visual Studio 2010

If it possible to use table valued functions in an EDMX with Entity Framework 5 RC / Visual Studio 2010?
I cannot see the option in the EDMX designer, I have a feeling that the designer is in .net 4.5? Are my suspicions correct? Or perhaps in Visual Studio 11?
I'm not really in a position to be able to upgrade our project to .net 4.5 yet, is there another way of using table valued functions (perhaps modifying the edmx by hand?).
ADDITIONAL INFO:
This blog post on msdn helps confirm the incompatibility:
Some features are only available when writing an application that
targets .NET 4.5. This includes enum support, spatial data types,
table-valued functions and the performance improvements. If you are
targeting .NET 4.0 you still get all the bug fixes and other minor
improvements.
However interestingly, this tutorial discuses modifying the EDMX directly to add support for TVF, but it appears to be for a an old beta. The XML intellisense also didn't find the elements discussed in the tutorial, but it might be because it was using a different schema. Unfortunately I've run out of time to try and apply the tutorial to the new EF5 Release candidate, but I'd be interested in knowing if anyone has had any luck.
Unfortunately table valued function support is currently dependent on .NET 4.5 and VS 2012.
I have been using this approach in order to use table-valued functions from EF 4. Basically it includes hand-editing the EDMX file. The downside to that approach is that you need to edit the file manually whenever you update your model.

Unmanaged Windows Service with VS2010

What's the best & fastest way to create an unmanaged Windows service with Visual C++ 2010?
Remark: From the lack of search results for this issue I'm suspecting this is either not recommended or trivial (a regular executable) - but I'm checking this for a colleague which insists not using the CLR.
I haven't tried it in VS2010, but it used to be fairly simple to create a Windows Service using ATL. As far as I remember there was even a project template for doing this.
Here's a CodeGuru article describing how to do it in VC++ 6.0.
Edit: Seems like it's still supported in VS2010 since it's still in the docs: ATL Services

Resources