I've a project using code first approach and EntityFramework 5.0 and im willing to add tracing but haven't gone far, i've read this link but im unable to make it work using DbContext approach. Original EF Tracing/Caching was written using ObjectContext and after reading thru lots of pages i still can't figure out how to make it work properly. In the link provided above, i'm getting an error not finding NorthwindContext.
Can someone provide some insight on where and how to compile a working solution using EFTracing with DBContext? A code Sample would be a huge help.
Thanks,
Ricardo
There are some hoops you need to jump through. I blogged about this here: http://blog.3d-logic.com/2012/03/31/using-tracing-and-caching-provider-wrappers-with-codefirst/. Hopefully it will help you resolve your problem.
EDIT
EF6 now contains a built-in mechanism for logging/tracing. From more details see the feature specification and this blog post.
Related
I'm starting a project and already check how useful is gobuffalo/pop.
I have never previously used a framework for my GO projects. I just used the stdlib and I'm used to working with Django too.
In Django it is pretty straight forward to create/update a model and generate its migrations. It gets the current DjangoModel and generates a migration with the changes. What a surprise to me when I can't find how to do it with pop.
I already checked the documentation but I couldn't find any examples.
How do you do that?
Right now, you can only generate empty migrations and write them yourself: https://gobuffalo.io/en/docs/db/migrations#writing-migrations
There's an issue asking to implement a Django-like migrations generator (https://github.com/gobuffalo/pop/issues/184), but it's not done yet and requires a lot of work.
I have some trouble using the EF Power Tools and I searched now for several days but I didn't find any solution for my problem.
Maybe someone has a new idea or hint for me. My problem is that when I want to create a Preview Data Model VS says that it couldn't find the required ADO.NET driver. I'm working with Postgres and EF 6.
It worked several days before but, as far as I can see within my source control nothing important changed. So I started to search for a solution and tried several things. I guess it has something to do with my app.config but I have no idea what I'm exactly missing there.
The app it self runs great and also the connection to the db works fine, only the EF power tools seems to have a problem.
It would be great if anyone could help me.
Regards Alex
After adding an entity model either from the datasources toolbox itself or by adding it => "add" => "new item" it does not show up in the datasources toolbox and therefor i dont get that easy drop and drag functionality.
If I add a dataset it works but that is an older technology (is it not?) everything in my current project are entity models and to change to datasets (which only works if I add xmlns:yourAlias="clr-namespace:WpfApplication3") would be .. I don't think best practice and a waste of time.
I have recreated this same process of adding a entity model in VS 2010 and it works 100%, where i have the ability to simply drop and drag from the dataSource toolbox
Maybe ill just wait for VS SP1 before working with it for client projects. :(
//Edit
If I add the ADO.net Entity model in VS2010 and then load the project in 2012 it loads fine in the dataSource toolbox. This is an answer but not an ideal work around.
While working on a project I recently faced the same problem. It took me about two days of extensive research but I think I've finally found it:
http://msdn.microsoft.com/en-us/data/jj556581
At least for me it solved the problem. Please let me know if it helped you..
Being addicted to L2S, I tried to get familiar with VS2012 and EF5. But I nearly lost my nerves trying to use the data sources toolbox.
Finally I found a solution:
using Object Data Source is now the recommended approach for using EF in databinding scenarios. See this article for more details - http://msdn.microsoft.com/en-us/data/jj574514. The article also includes a link to revert to the old code generation if that is what you desire.
I'm using Entity Framework Migrations & Code First and recently encountered a very weird problem.
The problem was reproduced with versions 4.3.1 and 4.4.
EF thinks that the context was changed while actually it didn't.
It happens when I change the path of the solution. for example:
If my solution is located in C:\integration\something.sln the migration may work but if now I will change the path to C:\development\something.sln and re-build the solution the migration will throw an exception saying there are pending changes in the database. (Of course without any changes in the source code.
I used IL Disassembler to create a dump of the output assemblies and with BeyondCompare I saw that there are differences. I assume the data is the same but its written in different order...
How EF determines if there were changes in the context? Is it possible that the assembly check-sum comes out different and will cause EF to think that there were changes?
Any ideas are most welcome...
First, this is not a migration issue - its probably a bug in the Entity Framework's algorithm to check if there are changes in the database.
I had a class hierarchy that contained an abstract class with no properties, making that class not abstract solved the problem.
After gaining some precious debugging experience, I found several ways to solve this issue and each one raised more eyebrows than the one before which makes me very convinced that I fell on a very rare corner case. As I mentioned, I decided to solve by making a class not abstract.
I tried to reproduce the bug in a clean solution so I can send it to Microsoft but until now it didn't really work.
So... to sum things up, if you find yourself with such a problem (very frustrating one), a good tip is to look for abstract classes!
Looking for the simple layered example that uses code first and repository, with either winforms or WPF (no ASP.NET).
I did not realize it is such an unusual question. Does anybody know of any example? I would like to use entity framework code first in layered project, but all samples I could find use ASP.NET (not familiar with), or use .edmx file, or are a simple console project. I can not connect the dots on how to actually make it work, and simple example would really help.
You can start by this one, EF Code First and WPF with the Chinook database
Follow it up by this ONE