Is SQL Server CE 4 in a VS2010 WinForms application possible? - sql-server-ce-4

I'm trying to use SQL CE 4 via Entity Framework 4 in a WinForm application. Can anybody answer if this combination is possible?

Ye, it is possible, but the EDM Wizard does not support this combination. You can use my SQL Server Compact toolbox add-in to create a EDMX in your class library or winforms projects

Related

Cannot find ADO.Net in VS2022 Community Edition

I've recently started using VS2022 Community Edition Version 17.4.4 after using VS2017 Enterprise Edition for many years. I've started a new project after selecting ASP.Net Core Web App using MVC. After creating the project, I used Nuget to import the MS.EntityFramwork packages I need and the went to add a new item to select ADO.Net from my DB for my Entity Framework. However, as you can see from the screenshot below the packages are there but ADO.Net is not.
Although I cannot find ADO.Net I can select Scaffolding if I want to and something tells me that is the only option available to me. I've used this process of adding Entity Framework many times and I think it's no coincidence that it isn't available after updating my Visual Studio. Can someone please confirm this is my only option to work with my SQL database or is there something I'm missing in order to access ADO.Net.
ADO.Net only works with .Net Framework. You can pay attention to see what your framework version is. If it is .Net XXX, it should be that you have created the wrong project, and the type of project you should create is ASP.Net Web Application (.Net Framework).
If following the methods above doesn't work, please speak up.

Entity Framework 6 (5) connection to Oracle

I am attempting to write a Data Access library for our suite of applications that use Oracle in .net. We currently use NHibernate and are thinking of migrating away as it appears to not be supported all that well.
I am working with Visual Studio 2013 and we have already constructed our Oracle Database. We don't have writes to update it (that is the domain of the db guys). So that will not be part of any calculation on our end.
The client on the server is 32 bit, so we are going to stick with that for now. It is already GAC'd in there, and no need to change it. So we have the 32 bit client on our development boxes.
I have EntityFramework 6.1.0 installed into my project via nuget. I have ODAC 1.112.3.20 installed in my project. The 32bit version of the application. I also have the ODP.net.x86 driver installed (also via nuget).
The problem is that everytime I attempt to create an ADO.net Database connection, the oracle provider is never an option? What am I missing? What do I need to get this to work?
I read an oracle forum one time that said I need to set my Entity Framework to 5.0 and not 6.0. Which is fine, but how do I do that?
EF 6 support is now provided by ODAC 12c Release 3 Beta:
From the .Net Developer newsletter (emphasis mine):
New Download: ODAC 12c Release 3 Beta The new ODAC beta includes
Entity Framework 6, Code First, Code First Migrations, .NET Framework
4.5.2 certification, managed ODP.NET XML DB, and managed ODP.NET distributed transaction support without Oracle.ManagedDataAccessDTC.dll.
I know this is getting a little old, but this is to answer the last part of your question (how to install EFv5). (Instructions written for VisualStudio 2013) with your solution open, click TOOLS->NuGet Package Manager->Package Manager Console. Enter the following:
Install-Package EntityFramework -Version 5.0.0
Edit
It’s been a while since I set up my machine, but I think this is what I had to do, hopefully it helps.
Setup:
Install Oracle Instant Client (or whatever you do for an Oracle Home)
Install ODTwithODAC121012 (if you Google that, it should come up)
Make sure your tnsnames.ora is in the right place for your Oracle Home
Setting up a new Visual Studio Solution:
New Solution (for me, of type ASP.NET Web Application)
Run command as in original answer
Add new project of type Class Library (for Model/Entities)
In new project, add new Item of type ADO.NET Entity Data Model
In Entity Data Model Wizard:
EF Designer from database (if you are using an existing database)
New Connection
In Data Source, there is (hopefully) an Oracle Database option
And below that, in data provider, I chose the ODP.NET Managed Driver
Enter user/pass, select Data Source and name connection
Edit 2
Oh, I forgot one thing, not sure if it's important. You may need to add a reference in that Model project to the oracle driver. Right click project -> Add -> Reference -> Assemblies -> Search for 'oracle', hopefully there is an entry for Oracle.ManagedDataAccess (my version was 4.121.1.0)
A few rants:
I don't think the process should be quite so difficult
I don't know why it takes them so long to update either. http://www.devart.com/ seems to do just fine staying on top of new Oracle/Visual Studio changes (they charge, but so does Oracle)
The conspiracy part of my brain says that Oracle has no interest in making it easier for you to not use their products and so they put no effort into it
Their default number mappings can really screw you up. For example, if your Oracle DB has fields of type NUMBER(10), it will map it as a 32-bit int, when not all 10 digit numbers fit :(
For more info on that mapping thing (the link shows how to override that 32-bit problem), see:
http://docs.oracle.com/cd/E56485_01/win.121/e55744/InstallConfig.htm#ODPNT8167
EF 6 is not yet supported by ODP.NET. See the release notes (README) for more info. EF6 will be supported shortly.
Edit: EF6 is now supported.
Sorry, I missed part of your question.
If you are using Visual Studio 2013, you must download Oracle Developer Tools for Visual Studio version 12.1.0.1.2 or later. With any older version, it will not be able to integrate with VS 2013.
Here is the download location:
http://www.oracle.com/technetwork/topics/dotnet/utilsoft-086879.html
EF 6.0 is not supported yet but you can use EF5 providers in VS 2013. So my other answer is not really relevant.
Entity Framework 6 Code First
ODAC 12c R3 is the first ODP.NET release to certify with Entity
Framework (EF) 6 and EF Code First. EF Code First is a popular
development model for .NET object-relational mapping. Developers
define the application domain model using source code, rather than
with a designer or an XML-based configuration file. An EF Code First
model's classes are defined in code through Plain Old CLR Objects
(POCOs).
...
These features are all available in both managed and unmanaged
ODP.NET.
http://cshay.blogspot.com/2014/09/odac-12c-release-3-beta-now-available.html

Does ODP.NET support EF Model-First with DbContext?

We're trying to use an Entity Framework Model-First approach with Oracle 11g and ODP.NET 11.2.0.3.20. We'd like to use EF 4.1 or EF 5.0 with DbContext.
Short version:
Has anyone managed to do that?
Long version:
On VS2010 and Entity Framework 4.0, everything works fine. I'm able to Generate Database from Model.
When I try it with EF 4.1 or EF 5.0, I always end up with an Object reference not set to an instance of an Object error message in Visual Studio:
I tried it the following ways:
Created a new EF 5.0 model in VS2012, set code generation workflow and templates to the Oracle stuff (Generate Oracle via T4 (TPT).xaml and SSDLToOracle.tt). Then I clicked on Generate Database from Model and chose a working Oracle connection, but Visual Studio just shows that error.
Created an EF 4.1 model in VS2012, same error.
Created an EF 4.1 model in VS2010, same error.
Tried a Database-First approach in EF 5.0 and EF 4.1, same error.
It only works if I'm using VS2010 and EF 4.0.
However, Oracle claims that it should work, see http://www.oracle.com/technetwork/topics/dotnet/downloads/install112030-1440546.html :
ODAC supports DbContext APIs.
Has anyone managed to use EF 4.1 or 5.0 with Oracle ODP.NET?
EDIT: Turns out it works fine on a 32-bit virtual machine. The problem is only there on my 64-bit Windows 7 machine.
Just delete corresponding connectionstring from project config file. Then choose new connection (to Oracle database) and click to generate DDL.

How to use Telerik ORM Reverse Mapping woth SQL Compact 4.0?

I was using Telerik ORM in Reverse Mapping Mode using SQL Server Compact 3.5. I upgraded the database to SQL Compact 4.0 and the reverse mapping started giving errors.
So i tried to recreate Reverse Mapping Model using Telerik ORM wizard and its says "Invalid database type".
I have the latest version of Telerik ORM
I have Visual Studio 2010 SP1 installed
I have Visual Studio Tools for SQL Compact 4.0 SP1 Installed.
I have all the necessary components installed for creating and managing SQL Compact 4.0
Telerik ORM created in a standard way works fine with SQL Comapct 4.0 but when i try to create model from SQL Compact 4.0 database using Reverse Mapping Wizard, it gives errors.
Has anyone experienced this issue?
Can anyone confirm that Reverse Mapping is supported with SQL Compact 4.0 or not?
An expert's response is highly appreciated.
Thanks
Steve
It looks like you are trying to create your data layer using the Classic API approach.
You could use the new approach for generating a domain model in your application, where the problem does not arise and SQL CE 4.0 can be used.

How do I get Entity Data Model to work with SQL Server CE 4.0?

I am trying to use Entity Framework with SQL Server CE 4.0. I installed VS10 SP1 with SQL Server CE etc. but when I tried to create an Entity Datamodel (.edmx), only SQL Server Compact 3.5 is shown as a provider, 4.0 is not on the list.
What should I do to get this to work? Thanks for any help!
This is by design, you can only do that in Web projects. But with SQL Server Cpmpact Toolbox, you can do it in any project type: http://sqlcetoolbox.codeplex.com

Resources