service-layer

MVC3 App/Service Layer/Repository Layer/POCO Classes/EF4 - Questions!

…衆ロ難τιáo~ 提交于 2019-12-03 01:31:20
问题 I am new to this whole design concept, and in reading for the last few weeks I have gathered a lot of information, but it seems scattered and conflicted. Terms are mixed, and I am just having a hard time wrapping my mind around this. The pattern I am using is like this and assume the flow as follows: MVC Application The controller(s) process the request/response from the client for a given view. Inside the controllers action methods, they contact the services (Service Layer) and either

Passing forms vs raw input to service layer

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-02 21:39:21
问题 Is it better to validate a form and pass its filtered input to the service layer, or to pass the raw input to the service layer, and have the service validate the input (with or without a form instance)? Obviously, if it's the latter, the controller still needs access to the form so that it can be sent to the view for rendering. If so, would you just access the form via the service ($service->getRegistrationForm())? See also: Dependency management in Zend Framework 2 MVC applications Factory

ZF + Doctrine 2 : Heavy model classes or Lightweight model + Service layer?

不想你离开。 提交于 2019-12-02 21:21:53
I am integrating Zend Framework and Doctrine 2 , and I am discovering the Service layer . Now I understand (am I wrong ?) that I have 2 architectures possible : A model , where classes contain domain logic, i.e. properties + getters/setters + complex methods A lightweight model , where classes contain properties + getters/setters and a Service layer, containing domain logic, and modifying the model classes What are the pros/cons of each ? It seems weird to me to lose OOP by putting domain logic as external to the model, so I don't understand why use a Service layer. What makes you think your

MVC3 App/Service Layer/Repository Layer/POCO Classes/EF4 - Questions!

微笑、不失礼 提交于 2019-12-02 16:47:25
I am new to this whole design concept, and in reading for the last few weeks I have gathered a lot of information, but it seems scattered and conflicted. Terms are mixed, and I am just having a hard time wrapping my mind around this. The pattern I am using is like this and assume the flow as follows: MVC Application The controller(s) process the request/response from the client for a given view. Inside the controllers action methods, they contact the services (Service Layer) and either request objects to build the view models, and sen the objects from the view models back. View Models I am

Are Doctrine2 repositories a good place to save my entities?

蓝咒 提交于 2019-12-02 15:42:49
When I read docs about repositories, it is often to work with entities & collection but in a "read-only" manner. There are never examples where repositories have methods like insertUser(User $user) or updateUser(User $user) . However, when using SOA, Service should not be working with Entity Manager (that's right, isn't it?) so: Should my service be aware of the global EntityManager? Should my service know only about the used Repositories (let's say, UserRepository & ArticleRepository) From that both questions, another one, should my service ever explicitly persist() & flush() my entities ?

Passing forms vs raw input to service layer

半世苍凉 提交于 2019-12-02 13:27:31
Is it better to validate a form and pass its filtered input to the service layer, or to pass the raw input to the service layer, and have the service validate the input (with or without a form instance)? Obviously, if it's the latter, the controller still needs access to the form so that it can be sent to the view for rendering. If so, would you just access the form via the service ($service->getRegistrationForm())? See also: Dependency management in Zend Framework 2 MVC applications Factory classes vs closures in Zend Framework 2 The Form itself should handle the validation, ZF2 has methods

SoapUI Maven plugin- executing multiple projects

帅比萌擦擦* 提交于 2019-11-30 19:42:03
I am working on converting an Ant execution of the SoapUI TestRunner to use the maven plugin and I cannot get a good answer on how to execute multiple projects using this plugin. I found a forum post from 2010 on the Smartbear forum and there are a few approaches listed but none seem very workable (writing some script to invoke maven with different parameters or adding an execution for every project). Are there any best practices for working around this? Or has anyone seen an inventive solution to this problem? I would guess that this is a large scale problem... Here is the post I am refering

Doctrine2 Best Practice, Should Entities use Services?

ぃ、小莉子 提交于 2019-11-30 10:22:08
I asked a similar question a while back: Using the Data Mapper Pattern, Should the Entities (Domain Objects) know about the Mapper? However, it was generic and I'm really interested in how to accomplish a few things with Doctrine2 specifically . Here's a simple example model: Each Thing can have a Vote from a User , a User may cast more than one Vote but only the last Vote counts. Because other data ( Msssage , etc) is related to the Vote , when the second Vote is placed the original Vote can't just be updated, it needs to be replaced. Currently Thing has this function: public function addVote

SoapUI Maven plugin- executing multiple projects

我只是一个虾纸丫 提交于 2019-11-30 04:49:48
问题 I am working on converting an Ant execution of the SoapUI TestRunner to use the maven plugin and I cannot get a good answer on how to execute multiple projects using this plugin. I found a forum post from 2010 on the Smartbear forum and there are a few approaches listed but none seem very workable (writing some script to invoke maven with different parameters or adding an execution for every project). Are there any best practices for working around this? Or has anyone seen an inventive

How to pass complex ViewModel to Service Layer in ASP.NET MVC?

杀马特。学长 韩版系。学妹 提交于 2019-11-30 02:29:35
Say I have RegisterModel for user registration and some UserService that implementing IUserService public interface IUserService { User CreateUser(User newUser); } [HttpPost] public ActionResult Register(RegisterModel model) { if (ModelState.IsValid) { // ... logic for newuser User user = _userService.CreateUser(newuser); _authenticationService.SetAuthenticatedUser(user); return RedirectToRoute("Homepage"); } return View(model); } Given that RegisterModel might be very complex, where is the logic should go for mapping RegisterModel to User object You never pass a view model to a service. A