Need example on building restful wcf web service with vb.net syntax - asp.net

What I need is a good example of creating restful wcf with vb.net syntax, but all I can find is C# examples, and I spend my time trying to convert to vb.net. If anyone knows of good sample code in vb.net please let me know, or send me a link.
I would like to see how to create and consume collection data. anything would be a big help, I am struggling.

Tried having a look at this?
http://msdn.microsoft.com/en-us/library/bb412178(v=vs.90).aspx
or this:
http://www.vb-tips.com/Making_a_REST_service_with_VB_and_WCF.aspx
I know that there's somewhat limited resources in VB.NET out there, but look at the c# ones and get the idea of how yo achieve it and then implement the same thing in VB.NET, I promise it's not that hard, I've gone from VB.NET to C# myself once.

Related

Web Application Organization/Structure?

I've used MVC before and really like the way it is organized but at times I have to go back to working on ASP.net Webform applications and really wonder what the best way to organize the code is.
Does anyone know of resources that deal with just that? I am pretty familiar with C# but would like to gain further insight.
An example would be a news article portion of a website.
You'd have a web form to display the data to users and then one for administrators to post the articles. Do you simply do everything in the code behind or do you farm it out to another controller-like class you've created?
Break the logical components into separate modules, which could mean separate namespaces; so you might end up with separate assemblies as well.
You cannot code everything into the code-behind; especially if you are doing a large project. All you need to do is to decide on the data exchange contract between modules, or layers. You should clearly specify the module1 guy that you will need a method Foo(param1, param2, param2):bool, and you expect it to translate news into another language.

ASP.NET UI Generation

I'm Looking for some samples (will be better if they are open source) that enabling Programmer to Generate UI from Database.
I want to review them for the framework that i want to develop for myself.
Already i reviewed ASP.NET Dynamic Data and Nettiers.
Also i welcome your suggestions , tips , comments.
Have a look at a project I'm about to release, CodeGenerator. There is a sample project which illustrates how you can use CodeGenerator to quickly generate an entire administrative site. Have a look and let me know your thoughts.
BTW, this is just a small example of what CodeGenerator can do.
While perhaps not directly what you may want, have a look at Entity Framework Code First to let the code drive the DB model and it works well with existing databases.
Then with MVC you could use MVCScaffolding to generate your views but in this case it uses the Models not the DB directly.
It's a slightly different way than you might be looking for but it is still worth a look to help you as you look at this.

Migrating from asp to asp.net - What are classic ado's recordset 'replacements'?

I've tried to do my homework on this...
I'm migrating a site from classic asp to asp.net 4.0
Before I rework all the code, I wanted to get clarification that the way i think my database code should be updated is fairly correct. (I'm using SQLClient objects)
First, when old code would use forward only recordsets or access single record/value, I'm fairly sure i'd use SqlCommand and SqlDataReader. That is pretty straightforward.
Now, when my old code navigates a recordset (movePrevious, find, etc.)... I believe the way to go is with SqlDataAdapter and DataTable to retrieve the data and DataView to filter/find/navigate the data.
I'n looking to do a quick migration... i don't want to get too bogged down in the new entity framework... so - just trying to stick with similar objects/logic.
I know this is one of those questions that doesn't really have a right/wrong answer... and I think that is part of my problem in finding an answer - there are so many.
Thanks,
bill g
I answered something similar here.
You only really need to know about the database bit here. For you it's a really good point to start as you mean to go on.
It terms of how deal with the data returned, it's up to you. I'd recommend custom class style dataset approach which will make life easier in the long run but of course in the short term, you'll have to generate them all which can be made easier by CodeSmith*. That in itself has an upfront cost but will, again, save time in the long run.
*Other code generation tools are available.
If your main issue is the database I propose to move and learn the Subsonic 2 (not subsonic 3, too slow) or any other DAL.
See here some examples:
http://subsonicproject.com/docs/Main_Page
Take some time to understand it, make some tests, see what really do, after wille you can't do with out it, but you need some time to understand the logic, and setup it to your project.
Get this project to play with and see some dal in action, ready to run.

When to use a webservice, page Method?

Just starting with JQuery. I have a couple of questions
When to use webmethods ,webservices , page methods , ashx
files in an ASP.NET 2.0 website ?
If I were designing an application where I'd use the webmethods on
multiple pages should I replace them
with a webservice ?
I suppose they all do the same thing but when to use which approach?
Thanks, Damien.
I don't use PageMethods anymore, but WebServices as it gives you a clean way to work with the data that you request. It also gives you the ability to use the data in other ways and in other places.
Have a look at http://api.jquery.com/jQuery.ajax/
To be more specific to your questions.
1. I might be bias, but since iv'e starting using asp.net mvc (I know you are using asp.net 2.0 WebForms), but it gives you a better feeling of separation of concerns and cleaner design.
PageMethods feels ugly for some reason right now. So, I'd personally advise against it and go with WebServices
If you are using a method in more than 1 page and it's generally to get data from an external provider such as a database or another webservice, it's best to extract this method into a webservice.
The approach I take is to think ahead just a little bit and don't over engineer. Keeps things simple and clean.

Architecture Critique: SQL Server FOR XML into XSLT for Rich HTML Interface

Can I get some constructive feedback about the following architecture?
Simplified Architecture Summary:
Return XML from your SQL Server (using FOR XML) and pass it straight into a XSL transform to produce a rich HTML web site.
What are the pro’s and con’s of such a system when compared with a conventional 3-tier ASP.NET architecture?
We have done something like this. And it works for very simple pages. But as soon as you would like to include some client side javascript and similar, you are doomed.
The generated output is hidden in the XSLT stylesheets and it is very hard to read, maintain and fix bugs.
Testing can be done, but also with much more effort than before.
The MVC pattern and similar is much better suited for such a scenario.
Two cons.
Data manipulation with C# or VB.net becomes harder because you don't have classes with properties (code intellisense) but xml-documents.
There are built in asp.net controls for data entry validation (both client side and server side). You can't use them if you use XSLT to produce your HTML-page.
I've done something similar in a project. I find the architecture very clean and scalable, but I would only advise you to use it if you happen to have lots of XSLT expertise in house.
We have a few XSLT templates, and a generic c# class that performs the transformation, using XSLT parameters. We get very good performance but, for new developers, the app can be hard to maintain.
One pro:
You can make XSLT-templates that produces HTML for the browser or XAML for WPF/Silverlight.

Resources