2

I would like to do a tremendous outcome with minimal effort: how do I write a Data Access Layer and Business Layers in C# for an old asp site written in VB. The problem in this regards the support of automatic typing between 2 different languages without using Web Services or any kind of string format (such as XML). It seems that the only way to do this is writing the whole site in C# (meaning, moving to asp.net or asp.net MVC, since this kind of upgrade is equal in time to change the whole site to asp c#) or writing the whole DAL and BLL in VB (which I wish not to do).

Thanks in advance.

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
lionheart
  • 437
  • 11
  • 33
  • 1
    Why don't you use VB.NET? In this case you'd cut down some amount of work. – Oybek Feb 17 '12 at 14:16
  • Just to comment out, your question is very broad. The advice (rewrite some part, some big part, or a whole new project) would depend on the quality of the previous project. Is there good separation of concerns, does the UI (i.e. HTML) worth to be retained (valid, some modern version), what are the underlying dependencies (DB, Services, other storage). – Oybek Feb 17 '12 at 14:19
  • @DanielHilgarth Yes but it is slightly easier to convert/link VB to VB.NET than to C# – Oybek Feb 17 '12 at 14:20
  • 1
    @Oybek I can't measure the project in quality, since it wasn't mine to begin with and all asp files (!) are written in the default directory - so quality is not the issue here, because there isn't quality in this project. It was written by several programmers until it was brought to me with problems and issues (of security and performance). As one said, patience is a virtue - and I'm glad that I was gifted with such virtue :-) – lionheart Feb 17 '12 at 14:41
  • @Oybek: In what way is it easier - assuming you are fluent in both VB.NET and C#? – Daniel Hilgarth Feb 17 '12 at 15:18
  • 1
    @DanielHilgarth Easier to rewrite the whole project from the strach, rather than spending hell a lot of time to understand others' legacy code before eventually giving up and starting a new project )). In this case you have many gifts of the mother nature such as Entity Framework, DI/IoC, MVC, jQuery, HTML5, Service-Repository pattern and many more )) – Oybek Feb 17 '12 at 15:25
  • @Oybek: Sorry to say that, but your comment doesn't make much sense. You didn't provide an answer to the question why it is easier to use VB.NET instead of C# when the legacy application is in VB. – Daniel Hilgarth Feb 17 '12 at 15:29
  • @DanielHilgarth If the legacy application is in vb then it is slightly easier to rewrite it in VB.NET. Further, though I've written the majority of my projects in C#, I prefer VB.NET for few, may be, subjective reasons. If nobody was against I'd rewrote it in VB.NET. Still it is difficult to judge without seeing the actual project. – Oybek Feb 17 '12 at 15:34
  • @Oybek I guess you're right, writing the whole project from scratch... and I wish my client understood what you're all saying. I'll try to convince my client, budget is the issue here. I've already managed to upgrade the MDB from MB to SQL server and redefine all SQL statements as stored procedures... I can't write the DAL or BLL without the understanding and permission of my client... Let's see how it goes from here. – lionheart Feb 17 '12 at 15:49

2 Answers2

5

As i have done this exercise in the past; i think i can put my 2 cents for the approach:

  1. You will have to write the BLL and the DAL from scratch as whatever the asp site is using should be left to rest.
  2. Reuse as much html and client-side js as possible. Dont forget to convert any client-side vbscript to js for cross-browser support.
  3. Yes you will have to understand how asp works before you do this to enable you to decipher the flow of the page and the chaos which is called "the includes" in asp.
  4. I would go with the webforms approach if asp.net mvc is not one of your strength; but if it is then a conversion from asp to asp.net mvc will be easier than to asp.net webforms.
  5. Patience is the key here! Best of Luck!!!
renegadeMind
  • 4,073
  • 5
  • 29
  • 37
  • That's the thing that I was trying to avoid. It seems that I must upgrade the site. Problem is that I'm getting paid by reaching benchmarks and endpoints throughout the project. The first thing (that i achieved) is moving from MDB to SQL server. Now, I need to get my client to upgrade (which is harder than make the move itself :-) )... Wish me luck, fellows ! – lionheart Feb 17 '12 at 14:48
2

How about using COM? Make your c# code expose a COM interface that you can call from VB. Some links here :-

Com Callable Wrapper, Stackoverflow article describing where some problems occurred

Community
  • 1
  • 1
Nick Ryan
  • 2,662
  • 1
  • 17
  • 24
  • This one is an interesting solution, I'll consider it. This is why I will make my vote for this answer. Thanks. – lionheart Feb 17 '12 at 14:43