开发者

How to implement PetaPoco with existing C# 3-tier win app

can anyone help me with converting my project to use PetaPoco?

here is my issue. backend is SQL 2010 database .NET fraimework 4.0

I have an existing 3-tier win app in C# that uses a custom DAL -- each Data call uses stored procs with parameters and 开发者_如何学JAVAeither returns dataset or specific value as needed -- each call accepts dataset referenced parameter and baseClass parameter (base class is identical to DB table schema well mostly)

I want to replace my custom DAL with PetaPoco but keep the 3-tier layout

the app is relying on predefined base classes as DTO to pass info between UI-BAL-DAL

does anyone have a sample/example of app solution layout as to how to use PetaPoco in 3-tier enviroment code example would be very helpfull

thanks in advance... Vlad


Example not really needed

All you have to do is get acquainted with PetaPoco library. The best way is its documentation. It's not a complicated/complex library, so you should get up to speed with it quite quickly.

If you also have you application broken down into projects for each layer (UI, BL, DAL), then the easiest thing to do is to create a new DAL project and implement all used functionality of existing DAL but use PetaPoco in this one. Then just change your project references and voila. That's it. You can keep your POCOs/DAO. If you've used IoC then it will be even easier because instantiating DAL repositories (or whatever you're using) is probably done via some DI container.

Layering and PetaPoco

PetaPoco has nothing to do with application layering. If you use it in 3-tier applicatin that's fine.

What are you using now?

You didn't mention which DAL library (if any) you're using right now. If you don't, then using PetaPoco will result in less lines of code and much simplified object mapping.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜