4

Our company has been using Telerik Open Access for years. We have multiple projects using it including some in development and some in production that need updated. Because Telerik no longer updates or supports Open Access, we are having a variety of problems. We've got users that have to go to another work station because we can't get Open Access on their computers and we've got projects where we can't add or update tables because the visual designer doesn't work in modern Visual Studio versions. So my question is, how do we convert these and what do we convert these to?

I've heard of Microsoft Entities Framework and we used to just call stored procedures instead of having a separate data project. Obviously our clients aren't going to pay us for hours to switch so we need something that works quick. How do we convert our existing Telerik Open Access project to Microsoft Entities Framework, straight SQL queries, or some other data layer option?

Here's an example of what we have currently.

A separate Visual Studio project that acts as our data layer where all the code was created by Telerik Open Access's visual designer:

enter image description here

We then have a DataAccess.cs class in our main project that creates the instance of the data layer:

enter image description here

Then we call it by using linq statements in the main project:

enter image description here

boilers222
  • 1,901
  • 7
  • 33
  • 71
  • According to their site, Telerik hasn't discontinued Open Access, but they've just re-branded it as Data Access. I can appreciate the desire to move to a more widely used ORM such as EF, but that's a pretty big project if you haven't structured the project to abstract the ORM tool (which isn't always trivial either) – MutantNinjaCodeMonkey Jan 19 '17 at 22:07
  • You may want to check their blog: http://www.telerik.com/blogs/upgrading-openaccess-orm-to-telerik-data-access – MutantNinjaCodeMonkey Jan 19 '17 at 22:14
  • That link is a couple years old. Telerik discontinued all support for Oepn Access/Data Access last year. I've sent repeated support tickets to them and always get a form letter saying that they can't help. So how do I switch to EF? – boilers222 Jan 20 '17 at 13:43
  • I spoke to a rep from Telerik (Now Progress) just a few minutes ago at a local dev event. He mentioned that they do still support open access, so I referred him to your post here. – MutantNinjaCodeMonkey Jan 23 '17 at 19:45

3 Answers3

4

I don't know OA hands-on, so I can only put my two-cents in.

I'm afraid this isn't going to be be an easy transition. I've yet to see the first seamless transition from one data layer implementation to another (and I've seen a few). The main cause for this is that IQueryable is a leaky abstraction. That is, the data layer exposes IQueryables, but

  • it doesn't support all features of the interface, and
  • it adds its own features, and
  • it's got its own interpretation of how to implement the features that are supported.

This means that if you're going to port your data layer to EF, you may notice that some LINQ queries throw runtime errors because they contain unsupported .Net methods/properties (for instance DateTime.Date), or perform worse -- or better, or return data in subtly different shapes or sorting orders.

Some important OA features that are missing in EF:

  • Runtime mappings (EF's mapping is static)
  • Bulk update/delete functions (with EF: only by using third-party libraries)
  • Second-leve cache
  • Profiler and Tuning Advisor
  • Streaming of large objects
  • Mixing database-side and client-side evaluation of LINQ queries (EF6: only db-evaluation)

On the other hand, the basic architectures of OA and EF don't seem to be too different. They both -

  • support POCOs
  • work with simple navigation properties
  • have a fluent mapping API
  • support LINQ through IQueryable<T>, where T is an entity class.
  • most importantly: both have revolve around the Unit of Work and Repository patterns. (For EF: DbContext and DbSet, respectively)

All-in-all it's goinig to be a delicate process of converting, trying and testing. One good thing is that your current DAL is already abstracted to a certain extent. Another is that the syntax doesn't even look too different. Where you have ...

dbContext.Add(newDockReport);
dbContext.SaveChanges();

... using EF this would become ...

dbContext.DockReports.Add(newDockReport);
dbContext.SaveChanges();

With EF-core it wouldn't even have to change one bit.

But that's another important choice to make: EF6 or EF-core? EF6 is stable, mature, feature-rich, but at the end of its life cycle (a phrase you've probably come to hate by now). EF-core, on the other hand, is the future, but is presently struggling to get bug-free in its major functions, not yet as feature-rich as EF6 (and some features will never return, although other new features are great improvements compared to EF6). At the moment, I'd be wary of using EF-core for enterprise applications, but I'm pretty sure that a year from now this is not an issue any more.

Whichever way you go, I'd start the process by writing large amounts of integration tests, if you didn't do so already. The advantage of integration tests is that you can avoid the hassle of mocking either framework first (which isn't trivial).

Gert Arnold
  • 105,341
  • 31
  • 202
  • 291
  • I agree here. I've not had luck either because abstracting the persistence layer is generally prone to leakage due to how different systems handle transactions, commits and data contexts. The happy medium I've landed on is to abstract the application layer above that consuming the ORM. But re-writing for a new ORM is a lot of work at that level, even if it's not re-writing everything. – MutantNinjaCodeMonkey Jan 23 '17 at 23:56
2

I have never heard of a tool that can do that.Expect it to take time.

You have to figure how to do it by yourself : ( for the exact safer way to migrate )

1rst you must have a simple page that use your DataLayer it will be your test page. A simple one that you can adapt the LinQ logic .

  1. Add a LinQ to SQL Class, Right click> Add > LinQ to SQL Class.
  2. Drop your table for this page only the usefull one, put the link if needed.
  3. In the test page create a new data context of the linQtoSql.
  4. Use it fixing the type and rename what have to be rename.
  5. Fix error till it compile.

Stock coffee and anything that can boost your brain.

  1. Add table to your context to match the one you had in telerik data access.
  2. Debug for days.
  3. Come back with new question on how to fix a new issue twice a day.
Drag and Drop
  • 2,672
  • 3
  • 25
  • 37
0

To help with the dbContext.Add() difference between the 2 frameworks you could use this extension in the EF 6.x :

public static void Add<T>(this DbContext db, T entityToCreate) where T : class
{
    db.Set<T>().Add(entityToCreate);
    db.SaveChanges();
}

then you could do :

db.Add(obj);

See Gert Arnold answer : In Entity Framework, how do I add a generic entity to its corresponding DbSet without a switch statement that enumerates all the possible DbSets?

JSON C11
  • 11,272
  • 7
  • 78
  • 65
Lou
  • 1
  • You need to format your answer and include the contents of the link in the answer for better understanding – Ibo Sep 29 '17 at 21:21
  • 1
    You do not need db.SaveChanges(); inside this method IMO. Telerik Data Access doesn't do it automatically either on the context.add() method... – tjeuten Mar 08 '18 at 21:05