Replace Devexpress XPO to Entity Framework - c#

I am working on an ASP.NET MVC web application that was built with DevExpress 12.1 tools including DevExpress XPO.
Due to licensing issue, I have task in which I want to remove Devexpress components entirely from that web application.
After r&d, I found at the first step of removing, I need to change datalayer to Entity-Framework (currently using XPO).
I know the manual process, but can anybody suggest how to do this? Is this any online tool or suggestion which achieve my work speedily?

I use XPO in one application and EF Core in another. I would happily move away from XPO forever, EF Core is a much better experience - the linq to entities is way better than linq to xpo, and while there are lots of other reasons, the most important thing is that you can change properties by ID with EF Core - in XPO you have to load the object first and then change the object reference. I have begun to truly loathe working with my project that is dependent on XPO so I have been looking for an answer for this for a long time.
I have sadly come to the conclusion that the best way is a gradual migration. You can run the models side by side and just change components over on a progressive basis. This way you can keep the application functional while moving between ORMs. There is sadly no esy way to do this.

Related

Best practise for SQL in .NET project

I'm a very beginner in .NET and now I'm developing a little project (web API) using NancyFX framework. In my project, I need to use SQL database for some very basic tasks like storing registered users' details or getting some user information. I'd like to know what is the most popular, convenient and modern way of using SQL in .NET for beginners? I mean, should I use LINQ or just pure SQLClient functionality or are there any good libraries for working with SQL on .NET? I've tried to implement LINQ to SQL pattern but ended up with huge chunks of unused auto generated code and even bigger mess in my head...
For a framework to communicate with you're database I would recommend using Entity framework, its very convenient and easy and has the Code first approach which you should read about.
More over i suggest you follow the repository pattern,
https://msdn.microsoft.com/en-us/library/ff649690.aspx
This basically means - each object you save in the db, will have a repository which will contain all the object of its kind and that will be you're entry point to reading/inserting/updatibg/and deleting rows from the db, while abstracting away all details of implementation - in our case I recommend entity framework as I mentioned before.
Good luck

ASP.NET Entity Framework MySql migration

I have this relatively big database for my website, currently in a MySQL database. As the site has been based on "one size fits all" solutions so far, the recent explosive growth of the website forced me to start developing a more fitting, more optimized and less fragmented platform.
Currently working on the back-end, for which an ASP.NET API suits me the best. I've decided to go with MySQL and use the Entity Framework to set things up. While it wasn't too much of an issue, I want to migrate all the data into a new, cleaner and better set up database. The issue is the users themselves - while I think ASP's Membership might be the best solution for me, I'm not sure how to migrate all my users' needed data to the new database, or even if Memberships are actually the best way to go about this. And this is what I need help in - could someone help me how to set up the API for this?
Edit: I've designed the new database inside Visual Studio with the EF Designer, but considering all the material I find, I suppose that's an issue? >_>

C# Entity Framework - Handling destructive autogen DB scripts with model first design

I recently started a new personal project to learn Entity Framework. My end goal is to make a desktop game that uses SQL compact for data management and uses Entity Framework for the game objects. Not actually knowing there were multiple ways to start EF (model first, code first, db first) I went with the most obvious choice of model first.
I've been working with it successfully now, however one thing concerns me, especially post-development. My goal with the game is that users can update to the latest version without losing any of their existing data. The current issue is that all the generation scripts are destructive by nature (dropping everything then recreating it) - that means I can't run those against the user SQLCE DBs out in "production", so I need to come up with an alternative plan of action.
That said, does anyone have recommended solutions on best practices? In previous desktop apps, I've traditionally used XML/binary to store data, which allows me to easily update the "schema" without affecting existing data (versioning in the app tailors the Load() according to the version, while the Save() always saves in the latest version).
What are some recommendations on handling this problem using SQLCE?
What you need, if understood right, is to utilize migrations which come with EF. Since the question is general this link should best guide you to what you need I think...
http://blogs.msdn.com/b/adonet/archive/2012/02/09/ef-4-3-code-based-migrations-walkthrough.aspx
With migrations which you can tailor manually if needed (and come in the shape of code which is applied at each point of change, incrementally) and you can also supply your 'seeding' if required.
i.e. you should be able to do most of what you require, delete, remove old incompatible data - and seed the new one that you have - and all related to a particular migration step you have.
How would that work with your app deployment specifically, that's a bit more complex I guess, but this should get you started, and then with each db version-breaking change your new code update would contain all the migrations since the previous update (or just one usually is enough, i.e. make it be one with each update) and the code to tear-down or create new things.
hope this helps,

Using Entity Framework with Telerik's Controls

I have worked with products of Telerik about two week,and in my opinion the Entity Framework is better than the Open Access(ORM), But i wonder that other Products of Telerik(EXP:GridView or ....) hasn't any problem with Entity Framework? I want to start a Project with Entity Framework and Telerik's Controls
You shouldn't run into any problems. Entity Framework and the Telerik Tools are compatible with one another, in fact I have used EF and Telerik together in a number of projects.
We use the EntityFramework in conjunction with Telerik's controls extensively, and have not had any issues or problems. Telerik's controls seem to always behave as expected when binding to individual objects or lists.
Good luck!
To take the classical 3 tier approach...
Are you asking if your data access layer (i.e. EF) is compatible with your UI (i.e. Telerik controls)?
The answer is kind of up to you as you should provide the middle layer (i.e. the business/service layer).
If you are finding direct dependencies between the two then I would advise looking at the architecture of the application. They shouldn't be connected directly.

Recommendations for C# database access

Hi I've programmed a fair bit of C#, but never with a database. I'd like to use SQL Server with C# with some framework. Microsoft seems to have shipped a number of frameworks through the lifetime of C#. This makes it difficult for me to search/choose.
Which one should I choose? I'm developing a simple 3-tier webapp. I've watched a few Entity Framework .Net 4.0 videos, but I get the feeling that things are too automatic. I need to do some SQL now and then..
And if I should go for the EF4.0, is this really the best reference http://msdn.microsoft.com/en-us/library/bb386876.aspx
Any recommendations?
Go with Entity Framework 4 - it is the current and future best approach to SQL Server database. It is the basis for WCF Data Services, and the idea of a conceptual model will show up in other Microsoft product, for sure (Reporting Services and others, possibly).
And it does give you a lot of hooks to allow you to execute "on the fly" SQL statements, and you can also integrate stored procedures very nicely into Entity Framework.
And for the "run of the mill" everyday tasks, it gives you nice C# objects - based on your database - to work with.
In my opinion, this is your best choice currently - and the one with the most flexibility and options. You can start with a database ("database first") and create your classes from existing tables; or you can start with a model and have EF4 generate your database for you, and EF v4.1 (due out pretty soon) will also offer "code-first" development where you don't even need a visual model but you can describe all your database objects and settings in just C# code.
Update:
Entity Framework 4 Overview
Learn Entity Framework - the site accompanying the book by the same name, by Julie Lerman, Goddess of EF :-)
ADO.NET team blog with lots of good EF stuff
Entity Framework team design blog
ASP.NET 4.0 and the Entity Framework 4 - Part 1 - Create a Database using Model-First Development - good intro for EF4 model-first approach; Vince has multiple articles here - click on his name to get a list of all his articles (many new ones EF4 related)
Introduction to Entity Framework (this was for v1 - but still good)
C#+ActiveRecord+NHibernate. Hide the implementation behind several WCF services.
You said you want to try some 'framework', so Entity Framework is that one. It is the result from best practices MS come up with after years of research. Of course, on the way, you can always use SQL (Dataset) anytime you want together with EF (mostly for performance tuning).
I would say Start with Rob Conery's Sub Sonic..
Its easy to start with..specillaly Simple Repository..
Site Link: http://www.subsonicproject.com/
Simple Repository using Sub Sonic:
http://subsonicproject.com/docs/Simple_Repo_5_Minute_Demo
Update:
I have seen one answer mentioning NHibernate and want to add a small addition to the same... and since OP mentinoned that you have good experience with C# I assume you have good OOPS knowledge and also the relationships amongs objects
I personally felt much easy to start with NHibernate when used it with Fluent NHibernate hence I would also suggest
C# + NHibernate + Fluent Nhibernate....
Take a look here for some information about performance/benchmarks on various ORM frameworks for .Net.

Categories