web service designer generated code in WCF

Posted on 2012-09-20
Last Modified: 2012-09-24
I convert a web service to WCF service, the web service has designer generated code, include a method, the InitializeComponent(), inside it has a SqlConnection1, SqlDataAdapter1, SqlSelectCommand1, and there is a sql statement for SqlSelectCommand1, should I move this method to WCF service?  How to move it?

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

end sub
Question by:5281
    1 Comment
    LVL 25

    Accepted Solution

    InitializeComponent, method can be reused. Call it the same way as it was called in web service.

    But is always a better to open a connection and close it inside the web method.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now