This is a migrated thread and some comments may be shown as answers.

WCF Services Wizard or code by hand

1 Answer 38 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Marcel
Top achievements
Rank 1
Marcel asked on 14 Jul 2014, 06:06 PM

Hello,

 
I am working on a project that will migrate and update an existing EF database application to a service application using WCF. This new application will be
using Telerik Open Access instead of Entity Framework.

The last few weeks I am doing some research on service application using WCF, because I have not much experience with it. At this moment I am getting some understanding how I should build this.

I started a test project to build a demo application, in which I will test different solutions of problems I will face. I have created a new rlinq model which holds
all the tables of the database. I am now at the stage of generating the server side code for this model.

My main concern now is if I will use the Telerik WCF Plain Services wizard to generate my repositories, services and DTO’s or will I code them by hand.

Pros of the wizard (for me):
        
-   The database will be updated a lot in the feature, because we are still adding new tables to the database in the end it will contain 200-300 tables. Using the
wizard I can easily update the generated code.
     
-   It will save me a lot of time compared to code everything by hand.

The main disadvantage for me is that the wizard is creating all types inside one file (all services are in one file, all repositories in one etc.). I don’t feel very comfortable
with this and of the fact that I don’t have any control of how and what is generated.

My plan was to create separate libraries for the services, dto and repositories, this will give me a clear separation of the different layers of the server-side. I am considering changing the code-generation templates but I am not very familiar with this. I also don’t know if this is possible to achieve.

Also I don’t know if I want to have a service/datacontract per table, maybe it will be more convenient to combine them by screen, or something else. This will not be
possible to achieve using the templates, then I will still be creating some of the code.

So I am a little stuck now, I followed a number of tutorials and read many blogs/forums on the internet, some people advise to code by hand and others advice to use
the code-generation.

This adds even more doubts, so should I go for the simple way and generate the code, in the future it will be very easy to update everything (in my understanding) if
the database will change.

Or should I go for the more complex way, this will give me more control of what and how everything is coded, but it comes at the cost of coding everything and more
work every time I update the database.

At this moment I am more convenient with the second option, because this will give me a good understanding of WCF and how it works in the end. My biggest fear is that this will bite me in the end, because I am making it more complex then it needs to be.

Any advice would be greatly appreciated.


Marcel

1 Answer, 1 is accepted

Sort by
0
Kristian Nikolov
Telerik team
answered on 16 Jul 2014, 06:43 AM
Hi Marcel,

Thank you for contacting us.

Your concerns are understandable. We will give you our thoughts on the subject and address your concerns. However please keep in mind that since the approach to implementing the WCF services is highly dependent on the specifics of your scenario and it would have a huge impact on the development of your system we cannot give you a concrete answer about which would be best for your situation.

Generally the Service Wizard is designed to save development time and produce an extensible service layer. However if the scenario has very specific requirements that would need a very high level of customization, the benefit of automatically generated service layer may be outweighed by the ability to have complete control over the design and architecture of the services.

You can also consider combining the two approaches. You could start up by using the Service Wizard to generate the service layer and customize it to your liking. While repeatedly using the wizard as your application grows, you can evaluate whether doing so will become too troublesome in the future and decide whether to switch to manually extending and modifying your existing code.

Regarding the location of the generated files as you have seen currently the Service Wizard provides little control of where the files would be generated. Certainly separating the files in different projects and folders can help have a cleaner project structure. You could consider whether moving the generated files manually to the desired folders or projects would an acceptable workaround.

We also have a feature request regarding this limitation at our Feedback Portal. We would like to invite you to vote for it and post any feedback you might have as doing so will help us prioritize its eventual implementation.

As for defining service contracts per view or based on other criteria, depending on the scenario this could be helpful but it can also introduce complex service structure which could be needed in order to avoid repeating logic for exposing the same entities over several service contracts. If your scenario would benefit from organizing your services in this manner, coding them by hand could be the better approach.

I hope this helps. In case you have additional questions or need help, do not hesitate to get back to us.

Regards,
Kristian Nikolov
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
Tags
General Discussions
Asked by
Marcel
Top achievements
Rank 1
Answers by
Kristian Nikolov
Telerik team
Share this question
or