separation-of-concerns

Ruby On Rails - Using concerns in controllers

隐身守侯 提交于 2019-12-21 04:36:09
问题 Possible Noob Warning: New to RoR I am trying to use concerns in RoR. Right now I just have a very simple concern writen #./app/controllers/concerns/foo.rb module Foo extend ActiveSupport::Concern def somethingfoo puts "Ayyyy! Foo" end end When I try and use this concern in my controller I get a undefined method error #./app/controllers/foo_controller.rb class FooController < ApplicationController include Foo def show Foo.somethingfoo # undefined method 'somethingfoo' for Foo:Module render

Linq to SQL DTOs and composite objects

混江龙づ霸主 提交于 2019-12-21 02:41:31
问题 I am using a similar approach to others in keeping my LINQ objects in my LINQ data provider and returning an IQueryable to allow filtering etc. This works fine for filtering a simple object by it's ID or other property, but I am having a problem with a join table object that is composed of other child objects //CoreDBDataContext db = coreDB; public IQueryable<DTO.Position> GetPositions() { return from p in coreDB.Positions select new DTO.Position { DTO.User = new DTO.User(p.User.id,p.User

How does Clojure approach Separation of Concerns?

五迷三道 提交于 2019-12-18 10:36:07
问题 How does Clojure approach Separation of Concerns ? Since code is data, functions can be passed as parameters and used as returns... And, since there is that principle "Better 1000 functions that work on 1 data structure, than 100 functions on 100 data structures" (or something like that). I mean, pack everything a map, give it a keyword as key, and that's it ? functions, scalars, collections, everything... The idea of Separation of Concerns is implemented, in Java, by means of Aspects (aspect

When to use JavaScript template engines?

偶尔善良 提交于 2019-12-18 10:16:18
问题 Here is an example of JavaScript template from Ben Nadel's demo single page long-lived AJAX application taken from: [source] <script id="contact-list-item-template" type="application/template"> <li class="contact clear-fix"> <div class="summary"> <a class="name">${name}</a> </div> <div class="actions"> <a href="javascript:void( 0 )" class="more">more</a>  |  <a href="#/contacts/edit/${id}" class="edit">edit</a>  |  <a href="#/contacts/delete/${id}" class="delete">delete</a> </div> <dl class=

ASP.NET MVC - separating large app

谁说我不能喝 提交于 2019-12-17 23:09:17
问题 I've been puzzled by what I consider a contradiction in terms: ASP.NET MVC claims to be furthering and supporting the "separation of concern" motto, which I find a great idea. However, it seems there's no way of separating out controllers, model or views into their own assembly, or separating areas into assemblies. With the fixed Controller , Model and View folders in your ASP.NET MVC, you're actually creating a huge hodge podge of things. Is that the separation of concerns, really?? Seems

Using Unity, how do you register type mappings for generics?

ぐ巨炮叔叔 提交于 2019-12-17 20:19:03
问题 I'm trying to implement a repository solution for Entity Framework but I am having trouble registering the types that include generics using Unity. Given: // IRepository interface public interface IRepository<TEntity> { // omitted for brevity } // Repository implementation public class Repository<TEntity, TContext> : IRepository<TEntity>, IDisposable where TEntity : class where TContext : DbContext { // omitted for brevity } // service layer constructor public MyServiceConstructor(IRepository

Construct testable business layer logic

依然范特西╮ 提交于 2019-12-17 17:16:18
问题 I am building an applications in .net/c#/Entity Framework that uses a layered architecture. The applications interface to the outside world is a WCF service Layer. Underneath this layer I have the BL, Shared Library and the DAL. Now, in order to make the business logic in my application testable, I am trying to introduce separation of concerns, loose coupling and high cohesion in order to be able to inject dependencies while testing. I need some pointers as to if my approach described below

MVC: Data Models and View Models

假装没事ソ 提交于 2019-12-17 08:47:29
问题 I've read some MVC advice in the past regarding models stating that you should not reuse the same model objects for the domain and the view; but I haven't been able to find anyone willing to discuss why this is bad. It is my opinion that creating two separate models - one for the domain, one for the view - and then mapping between them creates a lot of duplication, plus tedious mapping code (some of which might be alleviated by things like AutoMapper) that will likely be error prone. What

In a MVC tiered architecture a Repository class is part of the Business layer or not?

心已入冬 提交于 2019-12-13 02:35:30
问题 suppose you have an MVC application with the Model represented by an Entity Framework (EF) that "gets" data from a database and the action methods of the Controller that implements all the business logic. The Controller gets data from the database through the EF. Imagine that now you create a Repository class that is placed between Controller and Model. This way you have: 1) Controller : implements most of the business logic; 2) A Repository class , responsible to implement simple business

how to separate model library when using asp.net identity

对着背影说爱祢 提交于 2019-12-12 03:56:58
问题 I want to create application with layered architecture. I have separate Model project with only model classes Data project responsible for CodeFirst configuration, migrations, etc., Service project responsible for business logic, and preserving the data in the database using EF Dto project with classes used between Web app and service Web project with asp.net mvc application. My goal was to separate these projects so that Web project knows nothing about Model and Data - it just consumes