I am trying to make a tiny application, using SQLite and EF6.
I already have an SQLite database with tables and data, so I want to create a model and populate it from that. However despite everything I've tried I have had no success.
When adding a new "ADO.NET Entity Data Model" I have no option for SQLite database (this is on Visual Studio 2015).
I already saw this, this and this.
What I have done so far:
- First tried to simply install SQLite by NuGet - no luck.
- Then I created a new project, and instead of NuGet installed the latest x32 System.Data.SQLite setup package and made sure to check the option of installing design-time components for Visual Studio 2015 - no dice
- Then I saw someone had luck with installing an older version of the setup packages. After a painstaking installation (after removing the newer version) - no cigar.
- So I started following this one and, hooray - I can't add the assemblies, despite telling the setup to put them in the Global Trash Can or whatever.
So I come to you, dear people, hoping someone can wave a magic wand and help me get this thing that's supposed to be tiny, fast and easy to be, you guessed it - at all working.
New to the forum, hoping for some help. I have just started getting into Visual Studio and have installed VS Community 2015. I have searched for this answer and though it is listed a few times, the things that I saw in those threads I tried but no luck and it says not to ask questions, only provide a suggested answer so that's why I have started this new one. I am using this tutorial: https://msdn.microsoft.com/en-us/library/ms233763.aspx to create a sql database.
On the third line of instruction, it says: In the list of item templates, scroll down and choose Service-based Database. However, under Visual C# items, Service-based Database is not listed. I followed instructions in another thread to delete and re-setup the templates but it still does not show. I also confirmed that I have SQL Server Data Tools installed as SQL Server Object Explorer is listed when I go to the VIEW menu.
In the templates area when creating a new project, there is a SQL Server section below the Visual C# area which is for creating a new database project. It does not show it as Service-based Database so is it just a newer version of it and I should try my luck with that? I'm at a loss otherwise.
Thanks,
Todd
I'm working on small shopping cart project, and I'm using asp.net mvc 4 with SQL Server 2008, and development environment is Visual Studio 2013.
I have created database and I will give example:
I have one table called TransactionLines where I store purchased products, now I have relation to table Products, so relation in SQL Server Management Studio is OK
TransactionLines:ProductID -> Products:ProductID
but when I create .dbml file in VS relation is from TransactionLines:TransactionLineID -> Products:ProductID.
Does anyone know what is the problem with it?
Screen shot from SQL Server Management Studio
Screen shot from VS Server Explorer
Thanks in advance.
It must be bug with Visual Studio 2013, as I had this problem as well and a system reboot fixed it.
It came back a few weeks later and as far as I can tell it happens when I change certain tables in the DBML I need to immediately reboot the system after save and it works. I am still trying to figure out a better solution to UPDATING my DBML without requiring a system reboot.
If I do any changes to my EF 5.0 model, VS does not seem to see the changes. I have tried adding a new table, which shows up fine in the model, but then if I try to use it somewhere the table does not show up in intellisense and I can't use it.
I have also tried changing datatypes of a column, which again shows up fine if I look at the .edmx model file, but visual studio will still give me compiler errors on that field because I am trying to assign the incorrect datatype.
If I delete the EDMX completely, and recreate it, then the changes work fine. but it is tiresome to regenerate from database each time when I should be able to just "update model from database" and rebuild.
I have never had these problems with EF before. Does anyone know the cause or the fix to this problem?
Thanks.
First Build your Project and if it was successful, right click on the "model.tt" file and choose run custom tool. It will fix it.
Again Build your project and point to "model.context.tt" run custom tool. it will update DbSet lists.
If this is the bug with the edmx file located in a folder it is now fixed - download and install VS 2012 Update 1. You can get it from: http://www.microsoft.com/visualstudio/eng/downloads#d-visual-studio-2012-update
This is apparently a bug in the Entity Framework that the model does not get updated when your Edmx file is located inside a folder.
The workarounds available at the moment are:
Install VS 2012 Update 1 which should fix the bug.
If you are not in a position to install Update 1, you will have to right click on the model.tt T4 template file and click run custom tool. This will update the classes for you.
Hope that helps someone out there.
Link: http://thedatafarm.com/blog/data-access/watch-out-for-vs2012-edmx-code-generation-special-case/
I also had this problem, however, right-clicking on the model.tt file and running "Custom tool" didn't make any difference for me somehow, but a comment on the page Ghlouw linked to mentioned to use the menu item "BUILD > Transform All T4 Templates." which did it for me
Right click the .tt file and select "Run Custom Tool", that should update it:
You should have a <XXX>Model.tt file somewhere which is the T4 template that generates your model classes.
If it is in a different project, it will not update when you save the edmx file.
Anyway, try right-clicking on it in Solution Explorer and choosing Run Custom Tool
I searched for this answer because I had a similar situation in VS2013. In my case, I found that a simple "Clean Solution" cleared out all the old definitions.
Are you working in an N-Tiered project? If so, try rebuilding your Data Layer (or wherever your EDMX file is stored) before using it.
I've also experienced this problem with none of the classes being generated under the model.tt file. In my case it was down to issues with how I had built the DB in SQL2012. I'd set a column in a table to nullable that was also a foreign key and although I think you should be able to do this it caused a problem in EF5.
As soon as this was cleared and the diagram updated from the database they reappeared.
EF5 VS2013
After Changing the laptop When I updating Entity Framework model, stored procedures are not seen in code
What I have done to make this working
Update visual Studio 2012 Update 5 (Not Working)
Update/Modify from Programs (Not working)
After update stored procedures, build the project again then go to context.cs, right click and run custom tool (Not Working)
Doing RND (Someone says the issue is due to some permissions in MSSQL) But unfournately I have done alot of permission in MSSQL but (Not Working)
Install 2019 and run the project. Now everything works fine
Conclusion
Visual studio 2012 have a bug (bug is resolved in Update 1, 2, 3 and 4)
Change the Visual Studio version will resolve the issue
I had this problem in EF 6 using Visual Studio 2022. I tried all of the things here plus cleaning and rebuilding the solution, deleting the stored procedure out of EDMX and the database and re-updating, closing VS, and restarting my computer. None of those things worked. What ended up fixing it was simply opening the DTSEF.vb file. When I did that, Visual studio found the missing properties in the result object.
Greetings,
I have a server hosting c# projects/ solutions using VisualSVN/TortoiseSVN as the source control.
I opened one of those solutions (VS2008/.Net3.5) using VS2010.
It took me to the conversion wizard and once i SUCCESSFULLY finished and came out of conversion wizard, i go ahead and build the solution.
It builds fine. However, the server bindings that were supposed to show up do not appear. The entire solution in VS2010 does not seem to be in source control. Also, when i go to VisualSVN tab on the menu all the options like Update, Commit, Show Log, etc are grayed out.
Please suggest if i need to reinstall VisualSVN or is there anything missing. Thanks a lot.
Scott.
Yes, you need to reinstall VisualSVN. You might also need to purchase a newer version -- only the most recent versions work with Dev10 (the 2.xx series), and it is not a free upgrade :(.