Data persistance in Web Services?

前端 未结 3 583
暗喜
暗喜 2021-01-23 02:31

What are the solutions for data persistance in a .NET webservice?

I have a webservice. I give an id to my webservice and this one return the correct objet.



        
3条回答
  •  一向
    一向 (楼主)
    2021-01-23 03:25

    Alternatively, you can make your service a singleton

    [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single,
                     ConcurrencyMode = ConcurrencyMode.Single)]
    class Service
    ...
    

    However, this approach leads to huge problems in future. Do not store anything in-memory. If you do, you embed a state into the application. This leads to tremendous amount of work needed to achieve high reliability and scalability. No state, no pain.

提交回复
热议问题