What is the use of a persistence layer in any application?

前端 未结 5 1744
猫巷女王i
猫巷女王i 2020-12-12 22:42

I have to create an application in which I am asked to create an persistence layer in the application. The application is in .net. I have created a business layer and a pres

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-12 23:01

    If you're not saving your data somewhere, it won't be there again when your app is opened again. You can save it to a database as you said (SQL, Oracle, PostGRE etc.), or directly to disk (serializing in binary format, or plain text etc.).

    Using a layer to do that is a good practice. It reduces coupling (i.e. spaghetti code), and makes maintenance much easier.

    I suggest you read about Hibernate and it's .NET cousin, NHibernate.

提交回复
热议问题