잊지 않겠습니다.

Visual Studio 2005, 2008을 설치할때마다 "이건 뭐하는 것일까.."하는 생각이 드는 내용이였는데, 잘가는 blog에서 포스팅 한 결과를 보고 구경중. 

Flow chart를 그리고, 그 flow chart에 따른 코드를 넣는 것으로 모든 내용이 다 만들어지고, 그에 따른 흐름이 가능해지는 방법으로 여러가지로 살펴볼 내용들이 많다는 생각이 든다. 

각 흐름에 따른 Flow를 만들어주고, 그 Flow에 맞는 code를 작성해주고..

마치 개발을 할때, PM들이 흐름도를 대강 작성하고, 프로그래머들이 코드를 채워넣기만 하면 되는 개발방향과도 너무나도 유사하게 개발을 할 수 있게 되지 않을까.. 하는 생각이 갑자기 든다. 

    

VS2008개발 발표회때 강연자가 했던 이야기가 기억이 난다. "이렇게 편한 툴이 생긴것 자체가 개발자들에게는 악몽이 되고 있습니다. 누구나 다 개발을 할 수 있게 된다면, 우리는 이제는 필요 없게 되어버릴수도 있습니다." 약간의 엄살이 들어가 있는 이야기이긴 하지만,  왠지 모르게 많은 공감이 되고 있는 이야기들. 

WF.png 


10월달에 볼 책이 결정이 난건가....  

(SYNCmail Background worker를 이걸로 한번 만들어볼까나.) 


sample code: 

public sealed partial class Workflow1: SequentialWorkflowActivity

{

        public string PostalCode

        {

            get;

            set;

        }

   

        public Workflow1()

        {

        InitializeComponent();

        }

   

        /// <summary>

        /// check code in IF-ELSE

        /// </summary>

        /// <param name="sender"></param>

        /// <param name="e"></param>

        private void EvaluatiePostalCode(object sender, ConditionalEventArgs e)

        {

            string USCode = @"^(\d{5}$)|(\d{5}$\-\d{4}$)";

            string CanadianCode = @"^[ABCEGHJKLMNPRSTVXY]\d[A-Z] \d[A-Z]\d$";

   

            e.Result = ( Regex.IsMatch(PostalCode, USCode) || Regex.IsMatch(PostalCode, CanadianCode) );

        }

   

        /// <summary>

        /// method when true result from EvaluatiePostalCode

        /// </summary>

        /// <param name="sender"></param>

        /// <param name="e"></param>

        private void ValidatePostalCode(object sender, EventArgs e)

        {

            Console.WriteLine("Right Postal code");

        }

   

        /// <summary>

        /// method when false result from EvaluatiePostalCode

        /// </summary>

        /// <param name="sender"></param>

        /// <param name="e"></param>

        private void NotValidatePostalCode(object sender, EventArgs e)

        {

            Console.WriteLine("Wrong Postal code");

        }

}

   


Posted by Y2K
,

WCF Reliability

.NET Framework 2009. 1. 7. 11:30

 table1. Reliability and ordered message in bindings

 Name Support Reliability
 Default Reliability
 Supports ordered
 Default Ordered
 BasicHttpBinding No 
N/A 
No 
N/A 
 NetTcpBinding Yes
OFF
Yes
On
 NetPeerTcpBinding No
N/A
No
N/A
 NetNamedPipeBinding No
N/A (ON)
Yes
N/A (On)
 WSHttpBinding Yes
Off
Yes
On
 WSFederationHttpBinding Yes
OFF 
Yes
On
 WSDualHttpBinding Yes
On
Yes
On
 NetMsmqBinding No
N/A
No
N/A
 MsmqIntegrationBinding No
N/A
No
N/A

 

Reliability not supported binding

  • BasicHttpBinding : legacy ASMX service
  • NetPeerTcpBinding : designed for broadcast scenarios.
  • NetMsmqBinding, MsmqIntegrationBinding : this is not remote call. only disconnected calls.


Ordered Message

: WCF let you enable reliability but not ordered delivery.

: The default for all bindings that support reliability is that when reliability is enabled, ordered delivery is enabled as well.

: RequireOrderedDelivery property 

Posted by Y2K
,

WCF Elements

.NET Framework 2009. 1. 7. 11:29

1. Contracts

  • Service Contract
  • Data Contract
  • Fault Contracts
  • Message Contract 

OperationContract : 반드시 Method에서만 구현 가능하다. 이는 WCF Model에서의 제약조건으로 가지고 있으며, 동작에 의해서 구현되는 모델의 기본 사양이 된다. (property 또는 index, value에서는 절대로 구현할 수 없다.) 

1) Hosting

  • WCF Service는 반드시 Host Process 안에서 구현되어야지 된다.
  • Hosting 방법으로는 IIS를 이용하거나, Windows Application Service(WAS)를 이용하여 배포 가능하다.
A. IIS Hosting
  • ASMX web service와 유사한 방법. .svc를 만들어서, 배포(.asmx와 거의 동일하다.)
B. Self-Hosting
  • ServiceHost와 web.config(app.config)를 이용한 hosting. Program적으로 Hosting이 가능하다.
C. WAS Hosting

 

2. Binding

1) Basic binding
  • BasicHttpBinding 
  • legacy ASMX webservice
2) TCP binding
  • NetTcpBinding
  • Cross machine communication on the internet
  • optimized for WCF-WCF communication
3) Peer network binding
  • NetPeerTcpBinding
  • using all subscribe to the same grid and broadcast message
4) IPC binding
  • NetNamedPipeBinding
  • same machine communication
  • secure binding
5) Web Service binding
  • WSHttpBinding
  • http, https
6) Federated WS binding
  • WSFederationHttpBinding
  • supported federated security
7) Duplex WS binding
  • WSDualHttpBinding 
  • supported bidirectional communication
8) MSMQ binding
  • NetMsmqBinding 
9) MSMQ integration binding
  • MsmqIntegrationBinding
  • converts WCF message to and from MSMQ message
  • for legacy MSMQ client

3. EndPoints

  • an address : where the service is
  • binding : how to communicate with the service
  • contract : what the service does

The endpoint is the fusion of the address, contract and binding

Configuration : hosting process' config file.

              <endpoint
                address ="http://localhost/WCFProduct"
                binding="basicHttpBinding"
                contract="WCFProduct.IProduct"
                />

Programmatic Endpoint Configuration

      productsServiceHost = new ServiceHost(typeof(ProductServiceImpl));
      BasicHttpBinding binding = new BasicHttpBinding();
      productsServiceHost.AddServiceEndpoint(typeof(WCFProduct.IProduct), binding, "http://localhost:8000/WCFProduct");
      productsServiceHost.Open(); 

 

4. Metadata Exchange

HTTP-GET protocol을 이용한 metadata의 제공

WebService에서의 web browser를 이용한 Method view와 비슷한 내용을 제공한다.



Metadata Exchange Endpoint

기본적으로 제공되는 Metadata exchange endpoint가 아닌, special endpoint를 제공 가능.

 

5. Clint-Side Programming

1) IDE : Using "Add Service Reference" then add service url

2) SvcUtil : SvcUtil.exe (URL) /out:outputFileName.cs

  • make a class then make the client configuration file required to interact with a service
  • write service configuration with <system.serviceModel> <client> </client> </system.serviceModel> 
         <client>
            <endpoint address="http://localhost:8000/WCFProduct" binding="basicHttpBinding"
                bindingConfiguration="NewBinding0" contract="WCFProduct.IProduct"
                name="HttpHost">
                <identity>
                    <certificateReference storeName="My" storeLocation="LocalMachine"
                        x509FindType="FindBySubjectDistinguishedName" />
                </identity>
            </endpoint>
            <endpoint address="http://localhost:8000/WCFProduct" binding="basicHttpBinding"
                bindingConfiguration="BasicHttpBinding_IProduct" contract="WCFProduct.IProduct"
                name="BasicHttpBinding_IProduct" />
        </client>

3) Generating the client config file

svcutil.exe http://localhost:8002/MyService /out:proxy.cs /config:app.config 

4) Closing the proxy

      //Method 1 : Declare open and close
      client.Open(); //Open proxy
      client.ListProducts();
      client.Close(); //Close proxy

      //Method 2 : use using statement
      using ( client  = new WCFCLient.WCFProduct.ProductClient())
      {
        client.ListProducts();
      }

      //Method 3 : Use IDisposable interface
      IDisposable disposable = client as IDisposable;
      if ( disposable != null )
      {
        disposable.Dispose();
      }

5) Programmatic Client Configuration

      //Declare endpoint address with URL
      EndpointAddress endpointAddress = new EndpointAddress("http://localhost/WCFProduct/Service.svc");
      //Declare Binding method : http, https, tcp ....
      WSHttpBinding wsBinding = new WSHttpBinding();
      WCFProduct.ProductClient client = new WCFCLient.WCFProduct.ProductClient(wsBinding, endpointAddress);

 

6. Programmatic VS. Administrative Configuration

Administrative configuration

  • the option to change major aspects of the service and the clinet post-deployment
  • it's not type safe
  • configuration error will only be discovered at runtime

Programmatic configuration

  • be able to make an entire configurateion
  • decision is static and never changed. (it's hard-cording)
Posted by Y2K
,