Set working directory when Seed data - entity-framework-migrations

I'm trying to insert some sample data (Seed data) using EF 4.3 Migration.
The problem is I want to read data from xml file. But when I run Update-Database cmdlet, I got error like Could not find a part of the path 'C:\SampleData\'.
Is there anyway to set the working directory to current project folder when I run Update-Database from my powershell console.
Thanks in Advance.

I answered your question there http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/437709c0-6933-4ccb-8995-02438500b68b
:)

Related

Visual Studio: The system cannot find the path specified

I am developing a website in ASP.NET MVC in Visual Studio. I'm trying to add a Database connection, but it gives me the error "The system cannot find the path specified".
Here's what I am doing:
Right Click on Models Folder
New Item > ADO.NET Entity Data Model
EF Designer from Database
New Connection (SQL Database connection test succeeds)
Choose the tables I want to include
Press Finish
Error Appears
The Output Window says the following:
Generated model file: Model1.edmx.
Loading metadata from the database took 00:00:01.3576925.
Generating the model took 00:00:01.3134936.
However, the Models Folder is empty and no connection strings are made. I have been trying for about an hour and nothing, deleted the .vs, bin, and obj folders, rebuilt the solution but nothing works. I appreciate any help you can provide.
After much troubleshooting, I managed to fix the issue, details below:
Delete Models folder (backup any files inside)
Create a new empty Models folder
Add the new Model
Hope this helps anyone with this issue.

How to find Couchbase Mobile DB file in iOS?

I want to find Couchbase Mobile DB file location in iOS and please also describe how to open db file?
Thanks
If you are using CBM 1.4 or earlier, you can locate the location of the cblite2 db file as discussed here
https://developer.couchbase.com/documentation/mobile/1.4/guides/couchbase-lite/native-api/manager/index.html#dude-wheres-my-database-file
To view the database , you can use CouchbaseLiteViewer which is (not officially supported ) Mac application
https://github.com/couchbaselabs/CouchbaseLiteViewer.
You could also use any sqlite browser such as http://sqlitebrowser.org to browse the sqlite content
CouchbaseLiteViewer is not updated for checking data in Cblite 2.0 , i
waiting for it so as of now following way check Cblite db data and it
will work.
Latest solution Couchbase 2.0 db check:
There is a command line tool which I believe is inside the zip file that you download to get Couchbase Lite (look in tools) called "cblite" which is similar to the sqlite command line tool. It can perform operations on a database such as listing documents, querying, etc.
Download Couchbase sdk from the website
It comes with the folder inside this, there is a folder called Tools .
Screenshots for reference :
3.Inside tools cblite is there , just launch it . now suppose i have cblite db .
Use following way to query and this tools provide you comannd terminal way to search data/document :
I tried this and it works 👍
shobhakar$ ./cblite /Downloads/mobile-travel-sample-master/ios/TravelSample/TravelSample/prebuilt/travel-sample.cblite2
Opened database /Downloads/mobile-travel-sample-master/ios/TravelSample/TravelSample/prebuilt/travel-sample.cblite2/
This is the current solution and this is awesome.
Reference link : https://github.com/couchbase/couchbase-lite-ios/issues/2176#issuecomment-423921463

Why before using code for copy db to document folder Xcode automatically copy db and it is empty?

I used to suing code for copy db from bundle to document folder. But when run Xcode project before run my code database has copied to document folder and another problem is: Data base copied is empty. And when my code check document folder for exist db result is YES therefor not copy complete database to document folder.
I am using Xcode 8.1, iOS8.
Please help me.
Thank you.
Perhaps, you use XCode generated code, and on first call to managedObjectContext database is created. The simplest solution is:
check if database is empty (amount of records for some entity == 0)
if yes, copy your file from the bundle to the destination directory.
If your database is used in read-only mode you do not need to copy it into Documents folder at all - you can use it from bundle directory directly.
In this later case you'll need to set up proper key in persistent store options' directory and, copy index files, if you use SQLITE store into bundle as well.

How to get data from installed DB and insert the extracted data in New DB in iOS

I have a Database (used SQLite ) file that i copy in the documents while the applicaiotn is installed , now i have added one field in a Table and i want to install new DB in the Device. To achieve this i think i have to do Database Migration.
The issue i am facing is that I am not able to think the Code to get Whole Data from the installed Database and then insert that extracted data into New Database (while installation) , I have less experienced in iOS Programming so please Provide details from Scratch .
Thanks in Advance :)
This is not really an iOS issue, but a conceptional problem.
If you want to add new tables to the database, why do you copy an old version of the database rather than one that already contains the new tables?
As for the import of existing data, simply read out the old database and write it to the new database. This should be simple enough with the available SQLite API. Explaining the details would be beyond the scope of this question. (You will find enough info on these basic things online.)

Reverse-engineering Core Data db results in "Can't find model for source store" error

I have the task to re-engineer an iPhone app which makes use of Core Data to store some values. Unfortunately I do not have access to the original source code but I do have acces to old database files, copied directly from the device where the old version of the app is installed.
I have to create a new version of the app with some new functionality and I am trying to import the data from the Sqlite Db and migrate it to a new version.
I am already failing at the task to read the data from the old database. Though I can open the Sqlite file and such was able to exactly reproduce the data structure in my own datamodel, everytime I try to read the data, it fails with a
Can't find model for source store
error.
Ignoring the old data is not an option because there is important data stored there.
I googled for solutions and tried every recommended solution related to migrating data but it all fails. Maybe I can not use the Sqlite created by another app? Or so I overlook something in re-engineering the structure of the datamodel even when I used exactly the some field names and datatypes? Is there another way around this?
I could not solve the issue but I found a workaround. By using Sqlite directly, I was able to query the legacy data and import it into my newly created data model. A good starter point for using Sqlite is here:
http://www.techotopia.com/index.php/IOS_4_iPhone_Database_Implementation_using_SQLite

Resources