EF4 Code only ctp5: how set connectionstring devart oracle? - code-first

hi i have devart oracle provider 6(BETA), and want use code only ctp5...how i can set connectionstring for oracle?i started now with Code only and i need use oracle, anyone can help me?

You can find example and tutorial about Code-First usage by the following link - http://www.devart.com/blogs/dotconnect/index.php/entity-framework-code-first-support-for-oracle-mysql-postgresql-and-sqlite.html

OracleConnection you have to add refference: Devart.Oracle.Data i think.
it's very simple, if you do have any questions i use it too and i write code only applications.

OracleConnection(ConfigurationManager.ConnectionStrings["OracleConnection"].ConnectionString)
I am doing it like so.
using Devart.Data.Oracle;

Related

DefaultSQLExecutionStrategy missing

I have download EF6 using nuget (version 6.0.21010).
I can't find the DefaultSQLExecutionStrategy mentioned in this EF6 article - http://msdn.microsoft.com/en-us/data/dn456835
Can anyone tell me where it is... my System.Data.Entity.SqlServer only has SqlAzureExecutionStrategy and four other classes, but no DefaultSQLExecutionStrategy.
Thanks
It's here: https://entityframework.codeplex.com/SourceControl/latest#src/EntityFramework.SqlServer/DefaultSqlExecutionStrategy.cs. Note that this class is internal and is in the EntityFramework.SqlServer.dll.
EDIT
The article has been updated and it now says that this type is internal.

InsertHistoryOperation throws InvalidOperationException while no Database is existing

i have big Trouble using the EntityFramework 5.0. After updating EF in our Project from EF4.2 to EF5.0. The Framework throws InvalidOperationExceptions in the TypeInitializer of InsertHistoryOperation during initializing of the database. (In the InnerException it says: "The List does not contain any element").
I tried using DropCreateAlwaysInitializer as well as DropWhenModelChanges. We don't need the Migration Feature (Sure, would be nice to have, but not recommend). Is there a way to disable the Migration Feature so the exception is not thrown. Or can somebody give me a hint what i did wrong?
The Model is very complex, so i think its not very useful to post it here.
best regards,
Chris
I tried with .Net4.0 and .Net4.5
Ok, i got it.
The Problem is that the EntityFramework since V5.0 is not able to work correctly if you merge it into (e.g. a Datalayer Assembly) or use it from a merged assembly. (ILMerge).

How do you query the EclipseLink version at runtime (plus JPA meta data)?

Question pretty much says it all.
Is there an equivalent for org.hibernate.Version.getVersionString() in EclipseLink?
Why isn't there a portable (JPA) way to query provider information in general?
Never used it but from the Eclipselink javadoc you could try the following class:
org.eclipse.persistence.Version
There is a static class and static method to get this information.
Example: How to print in java code
AbstractSessionLog.getLog().log(SessionLog.INFO, DatabaseLogin.getVersion());

Changing the core data model versionIdentifier

I'm trying to debug an issue with my mapping model not being used by my migration, and so I printed out the sourceModel and destinationModel's versionIdentifiers, but both were blank.
http://developer.apple.com/library/ios/#documentation/cocoa/Reference/CoreDataFramework/Classes/NSManagedObjectModel_Class/Reference/Reference.html%23//apple_ref/occ/instm/NSManagedObjectModel/versionIdentifiers
This link says to set them in the model inspector but I can't find that on xcode 3 or 4... or at least there is no versionIdentifier or similar in anywhere I can find for the data model itself.
Does anyone know where I find that?
Take a look at this posting - and, in particular, my answer ;) : Core Data lightweight migration: Can't find or automatically infer mapping model for migration
I did not find versionIdentifiers to be as helpful in debugging as the 'metadata' for the various entities - as I outlined here: NSManagedObjectModel versionIdentifiers
Hope this helps.

Where should I put my connectionString in ASP.Net 3.5?

I have two projects:
ASP.Net 3.5 website (frontend, UI)
VB Class Library (dataaccess logic)
Where should I save my connectionString, so that I can use if from the class library? And how does this affect where it is placed when I deploy/publish?
Note:
I don't want to pass it to every function in my VB Class
Depending on how you constructed your DAL -- LINQ, TableAdapters, etc. -- it may automatically look for it in the web.config file. If you created the DAL via a designer, likely it stores the default connection string in the app.config file for you class library. I copy the connection strings section from the app.config file to my web.config and change the connection string to the correct database (I have separate web.config's for DEV/QA/PROD). This makes it trivial since the designer generated code already has the code implemented to retrieve it from the configuration file.
If you are hand-coding your DAL and need to pass in the connection string, I suggest setting up a strongly-typed configuration class that interfaces to the web.config and does lazy loading of your configuration values. Use a factory to create your DAL and inject the configuration class into your factory via constructor so that it knows how to create your DAL with the connectionsString retrieved from the configuration file.
My question came from having spent half a day of trying to make this work, but I kept getting the wrong connection when deploying (where I use another database).
My problem was, that I was using
My.Settings.DefaultConnectionString
...To retrieve the connectionString in my VB Class Library.
After following tvanfossons anwer, I dug around some more and found out, that I can simply use (after referencing system.configuration) :
System.Configuration.ConfigurationManager.ConnectionStrings.Item("DefaultConnectionString").ConnectionString
It looks in the web-config for webapplications and app.config for windows/class library apps.
I am glad it now works, but even more glad I know why. ;)
I had the same issue you were having and I ended up using the System.Configuration.ConfigurationManager class to obtain the connection string stored in my web.config file from my class library like Kjensen's answer suggested. This worked wonders, if I had more experience I would vote that answer up.
I needed the connection string to build my Linq2Sql data context, which this method provided me with.
I now build my data context like below (remembering to add a reference to System.Configuration) -
public MyDataContext() : base(System.Configuration.ConfigurationManager.ConnectionStrings["MyConnectionString"]
.ConnectionString, mappingSource)
And as long as the web.config file contains "MyConnectionString" the configuration manager takes care of the rest.
We keep ours in the machine.config of each server and have a custom DAL to handle all DB interaction for our web apps.
Put it in the web.config in the connection strings section.
In the VB project use HttpContext.Current.GetSection to retrieve the section.
A fellow developers idea once was that we should store all the connection strings in a database table.
Don't try doing that. You won't get very far. :)