Firebird Entity Framework - c#

I am using Firebird database and newly started with this database so I am implementing with Visual studio 2015. I am accessing a Firebird Embedded database using ADO.NET and my Firebird Embedded database file extension is .CMP. I am successfully using ADO.NET.
Now I want to use with Firebird Entity Framework. I have done a successful install. When I click entity data model and select the Firebird data source it opens connection properties where I select server type =1(embedded).
This is my ADO.NET connection string:
string Connectionstring = "User=SYSDBA;Password=masterkey;Database=localhost:G\\CLINEDB.CMP;DataSource=localhost;Port=3050;Dialect=3; Charset=NONE;Role=;Connection lifetime=15;Pooling=true; MinPoolSize=0;MaxPoolSize=50;Packet Size=8192;ServerType=1;"
When I click test connection it show this error:
Unable to load DLL fbembed: the specified module could not be found
I have downloaded the embedded folder from Firebird and added it to the project solution so in advance option added 'Client Library as fbclient.dll file from project solution' for this I am getting error
Connection lost to database
How can I fix this?

Related

LocalDB - New code-first databases no longer being created on default folder

I'm using Entity Framework's Code-First and LocalDB, with the following connection string:
Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=MyApp;Integrated Security=True;
Connect Timeout=30;Encrypt=False;TrustServerCertificate=True;
ApplicationIntent=ReadWrite;MultiSubnetFailover=False;MultipleActiveResultSets=true;
The instance and its database files were properly created inside this path:
C:\Users\Me\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\MSSQLLocalDB
But I was messing around and I renamed then deleted the MSSQLLocalDB through Visual Studio's "SQL Server Object Explorer" and its files. Now that I created it back, all databases generated via EF Code First are being created inside my %USERPROFILE% folder, i.e. C:\Users\Me.
In "SQL Server Object Explorer", if I right click and "Add New Database", it shows the right path. Right clicking the instance then properties shows that "Default Database Location" is correct.
The registry is correctly configured:
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Microsoft SQL Server\UserInstances\{9F44D466-A9BA-40E3-9DEA-21E0638C80A2}]
...
"DataDirectory"="C:\\Users\\Me\\AppData\\Local\\Microsoft\\Microsoft SQL Server Local DB\\Instances\\MSSQLLocalDB"
I tried to create a new instance through SqlLocalDB Utility with a different name, but it behaves the same way. Also tried rebooting, before and after deleting the instance, no success.
I also tried reinstalling. I uninstalled Visual Studio (Web and Desktop), MS Data Tools, MSSQL Compact and MS LocalDB, then reinstalled VS, but no success.
I don't want to change my connection string and point it to the correct path, since the project is shared and maintained by other developers.
How do I revert this behavior? I'm using Visual Studio 2015 Express.
You can set the path here (in registry):
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Microsoft SQL Server\UserInstances]
The path is not a part of your connection string, so do you really have a problem?

Could not add "ADO.net Entity Data Model" with sqlite

I am trying to setup entity framework with sqlite in visual studio 2012. So, here is what I have done so far:
Installed System.Data.Sqlite with "Design-Time Component".
Entity Framework Tools for visual studio 2012.
System.Data.SQLite,System.Data.SQLite.EF6 and System.Data.SQLite.Linq from NuGet.
Now I am trying to add "ADO.net Entity Data Model",By following steps:
Add New Item.
ADO.net Entity Data Model.
"EF Designer from Database" from wizard and click "Next".
Add "New Connection", Data Source: System.Data.Sqlite Database File.
After choosing db file and provide password when I click on "Next" button, following error occurs:
I have checked my db file in "Sqlite Browser" also I have setup password for db file with the help of following code:
string conn = #"Data Source=pahtto\App_Data\app_data.sqlite;";
SQLiteConnection connection = new SQLiteConnection(conn);
connection.SetPassword("123456");
connection.Close();
What am I missing?
Please guide me.
Thank you.
Try looking in your App.config file and change the connection string and set your password there.
old connection string
source=X:projectsmeowdb.sqlite;
modified Connections string
source=X:projectsmeowdb.sqlite;password=this is my password
Look at this link for more information
http://www.dxsdata.com/2013/09/visual-studio-with-sqlite-solving-error-file-is-encrypted-or-not-a-database/
It seems that the problem was in my db file even though it was working fine in "Sqlite Browser".
So, I just deleted and created new file and every thing works.

Add Controller database error in ASP.NET MVC 4

When using the Add Controller helper/scaffolder with Entity Framework CRUD integration, I get the following error:
Unable to retrieve metadata for 'MyApp.Models.MyModel'. Cannot attach the file
'C:\Users\Lev\AppData\Local\Temp\2d7daf19-d47f-df24-ac76-d3df4fg2sa\aspnet-MyApp-
20130409170533.mdf' as database 'aspnet-MyApp-20130409170533.mdf'.
The question is: Why is it looking for the database in my temp files? The database file is located in:
C:\Projects\MyApp\MyApp\App_Data
This is my connection string:
Data Source=(LocalDb)\v11.0;
Initial Catalog=aspnet-MyApp-20130409170533;
Integrated Security=SSPI;
AttachDBFilename=|DataDirectory|\aspnet-MyApp-20130409170533.mdf
And so it seems that the reference to |DataDirectory| is misbehaving. How can I set DataDirectory?
If I manually put the correct path into the AttachDBFilename property, then the scaffolding works. But I'd still love to leave it as |DataDirectory|.
Just restart the Visual Studio. This helped at my project.

How to use Entity Framework with an Oracle database

I'm a starter in Oracle, I want to use Entity Framework to connect to my Oracle database.
I first installed Oracle 11g R2 and get this and then I install NetManager and create new Service Name
Then, I go to Visual Studio and create a new model but wWhen I want to create a connection it gives me an error message.
Please help me. thanks all
It had happened me once. In your Oracle home directory there must be two folder in directory C or D:\app\user\product\11.2.0:
Names of folder must be smth like that:
client_1 and dbhome_1
There must be tnsnames.ora in \client_1\Network\Admin\Sample. If not, create one. Then first of all delete all texts in this file and copy this to that file:
orcl=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.77.31)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)))
Instead orcl you will write your data Source. Also for host and port number. And Service name.
It must work. If not copy tnsnames.ora and listener.ora to \client_1\Network\Admin.
And test it again.

Entity Framework model update on a remote machine

I'm building a web application that uses the Entity Framework. The files are located on a remote machine, the same is for the database and the web server.
In visual studio (2k8sp1), the path to the project is: \\Server\Web\XXXX
Now, I've generated the EF entities from the database, and later I've updated the database and added there a stored procedure.
When I wanted to update my model after that in visual studio, I was getting an error message that says:
An exception of type Systen.ArgumentException occured while attepting to update from the database. The exception message is: 'A relative path is not possible for files on different devices'.
Any ideas on how to update my model?
ps. I also cannot change my connection string in the EF model designer.
I think you might be using the Entity Framework incorrectly. The edmx files are source code, and should be treated as such. They should be added to your project, checked into source control, and edited locally on the development machine.
Try importing your model from your database into a local edmx and see if that works better for you.
You can also use EDMTools2 tool for update your EDM Schema like that. Also you can use this tools routines in your code it's open source. Just copy inside of your project and call some functions like create model, create code from model..
I hope this will be help to you

Categories

Resources