Architecture :: A Proper DI Implementation?

Feb 27, 2011

I'm fairly new to dependency injection but it seems like a proper DI implementation will be fairly complex.

For example, DI requires a centralized class that manages the configuration and resolves the dependencies at runtime.

DI is also based on the concept of using interfaces. For example, a SpecialLogger should use an ILogger interface.

The centralized DI manager class will need to register types - for example, associate ILogger to SpecialLogger.

SpecialLogger will also need to implement the ILogger interface so SpecialLogger can be used through the DI ILogger interface.

Therefore, it seems like a sln using DI will need multiple projects to support DI. Here is an example for logging:

* MyCompany.MyDivision.Framework.DI.Management - this would have the DI manager where dependency types are registered and resolved at runtime
* MyCompany.MyDivision.Framework.Logging - this would have the implementation of a logging class. The main logging class would need to implement ILogger.
* MyCompany.MyDivision.Framework.DI.Interfaces - this would have the ILogger interface.

Interfaces would need to be stored in a separate class library from the DI manager because both the DI manager and SpecialLogger use the ILogger interface. Since the DI manager associates SpecialLogger to ILogger a circular reference would be encountered without a separate class library to store the ILogger interface.

View 1 Replies


Similar Messages:

C# - Proper Implementation Of N-layer Architecture?

Feb 28, 2011

I have been learning C# for the last year or so and trying to incorporate best practices along the way. Between StackOverflow and other web resources, I thought I was on the right track to properly separating my concerns, but now I am having some doubts and want to make sure I am going down the right path before I convert my entire website over to this new architecture.

The current website is old ASP VBscript and has a existing database that is pretty ugly (no foreign keys and such) so at least for the first version in .NET I do not want to use and have to learn any ORM tools at this time.

I have the following items that are in separate namespaces and setup so that the UI layer can only see the DTOs and Business layers, and the Data layer can only be seen from the Business layer. Here is a simple example:

[Code]....

Am I completely off base? Should I also have the same properties in my BLL and not pass back DTOs to my UI? what is wrong and what is right. Keep in mind I am not a expert yet.

I would like to implement interfaces to my architecture, but I am still learning how to do that.

View 4 Replies

Proper Implementation Of MVP With Complex Controls?

Jan 20, 2010

I'm currently implementing a project using asp.net, c# and the MVP (Model-View-Presenter) pattern. The main purpose of this solution is to deliver a graph to the consumer, to be used by a variety of systems. It is basically a custom graph server.

The view page in this particular case has an MSChart control on it, which has to be dynamically populated and configured based on parameters in the QueryString. This can be as diverse as totally different types of data sets, display modes and so on, using a lot of the properties of the chart control.

Many of these properties are again of types which are particular to the chart control and would require the same dependencies as the chart control itself if they are to be set by the presenter.

I'm trying to figure out the best way to expose the properties to the presenter so it can work its magic.

Should I:

Just expose the whole chart object and live with a system.web type dependency in the presenter project? Make accessor and translation properties for all of the chart control properties so that I don't have the dependency, but add lots of complexity? Other, that I haven't thought of?

To me it seems that it would be against the MVP pattern to bubble a display control up into the presenter, but it seems that trying to map all the properties to DTOs or similar would be a lot of work that would add a lot of complexity, and while the solution would be somewhat more loosely coupled, I'm not sure the gain would be worth it in this case. How would you implement something like this, given MVP?

View 2 Replies

Architecture :: Function Implementation In 3-tier Architecture?

Apr 28, 2010

I have implemented the 3-tier architecture project; DAL, BAL, and presentation layer are three layers in it. I am going to implement the following scenario:

Presentation layer calls to a function in the BAL layer which returns 2 string variable, and in turn this function from BAL layer calls to a DAL layer function which also returns 2 string variable. How can I implement the above scenario?

View 2 Replies

C# - Proper Implementation Of Nested API Calls Using Connection Pool And Nested Transactions?

Jan 4, 2010

I need to know the best way to do the following. I have nested business level APIs (say level 1 & level 2). L1 needs to call L2. Both APIs use the database layer directly at their own nesting levels.

Now, in the database layer, I fetch the db connection from the pool each time as follows:

SqlConnection conn = new SqlConnection(connString);
conn.Open();

Is it proper to fetch the db connection each time on every DB level call as above? I know it will return a connection from the ASP.NET connection pool. However, wouldn't it be better to maintain the same DB connection throughout the nested calls (or throughout the current http request lifetime)? Will fetching a connection from the pool each time cause issues with nested TransactionScopes?

View 1 Replies

Website Translation Architecture And Implementation?

Mar 18, 2011

I'm conducting a project in which a website should have multi-language support.Now, this website is supposed to serve about 500K+ visitors a day, so it must be super-efficient.

I've created a table of parameters {[ID],[Name]} AND a linkage-table {[objectID],[parameterID],[languageID],[value]}. I think it's the best way to deploy multi-language support while having the privilege to translate different parameters for each language.

As far as I know, server's memory is much faster than a physical HDD. Therefore, I'm planning to store ASP.NET Application State objects for my translation architecture.[URL]

View 3 Replies

Architecture :: Implementation Of User Authentication In C#?

Feb 15, 2011

I am working on a web application project with a layered architectural style having DAL, BLL, Service Layer and Presentation Layer. It's going to be a Web forms application.

My intent is to try using some of the new features of .Net 3.5 or 4.0.

Currently, I am thinking through different approaches for implementing Authentication in this project.

I have a query regarding the design of the application, particularly Authentication.

In which layer should I have Authentication class? BLL? If I implement the Authentication class in BLL, should I be having an app.config in the same class library project to contain the Database connection string and all.

View 7 Replies

Architecture :: Key, Value Pairs Implementation In Class?

Feb 16, 2010

In a project im working on there are many sql tables containing different ID, Name pairs. Those are represented as Enums in classes that need them however that requires casting since tables contain ID only.Also when serialize the Enum contains the ID not value.

View 3 Replies

Architecture :: Search Engine Implementation?

Jul 22, 2010

not sure if I'm posting to the right thread or not.. but here is the questiondoes anyone know how to implement a best pratice on SEO?One of the example is: if the user types "brand new canon camera" then I want the system to find a sequence of string in the database that contains "new", "cannon", "camera". It is ok with or without the word "brand". However if the user types "HP laptop DV1000" and i want the system to find all HP laptop whether new or not but limited to specific series.

View 3 Replies

Architecture :: What's The Advantages / Disadvantages Of Explicit Interface Implementation

Jul 19, 2010

I am searching for the advantages and disadvantages of the explicit interface implementation

View 1 Replies

Architecture :: Generic Comments Module (Database Design And Implementation)

Feb 10, 2010

I am in the process of redesigning our main product, a knowledge database system for clients to access clinical and specialist advice articles. There is a requirement to add "Social Networking" to this allowing users to connect and post remarks etc...

This is somewhat similar to the Facebook wall scenario - where Articles, Photos, Groups, Products, Events, ActivityFeed can all have comments. I am at a lose as to the database design I would need to implement this. All comments must allow for Moderation/Approval/Spam Reporting etc...

I originally thought a individual table for each Comments entity ex: ArticleComment, ProductComment would work as the comments themselves are not all directly related. Each table having the same exact columns. But this makes life abit awkward as then this creates a separation between something that for all purposes is the same i.e. They are all comments.

The other design idea was to have a single Comment table with an "arc" type relationship to related tables with FK references back to the source.

The other option was to have a single Comment table with an Object Type and XID but this breaks the rules of relation and does not all for referential integrity.

I am at a lose and don't know what to do. I have asked over at SQLCentral.com and all I have done is raised more questions than answers about what to do.

Design 1: This would require exact copies of this table for all the entities.

-- Photo Comments --
CREATE TABLE dbo.PhotoComment
(
CommentID int IDENTITY(1,1) NOT NULL,
PhotoID int NOT NULL,
Body ntext NOT NULL,
ReportedAsSpam bit NOT NULL CONSTRAINT [DF_PhotoComment_ReportedAsSpam] DEFAULT (0),
IsSpam bit NOT NULL CONSTRAINT [DF_PhotoComment_IsSpam] DEFAULT (0),
IsApproved bit NOT NULL CONSTRAINT [DF_PhotoComment_IsApproved] DEFAULT (1),
CreatedDate datetime NOT NULL,
CreatedBy uniqueidentifier NOT NULL,
UpdatedDate datetime NOT NULL,
UpdatedBy uniqueidentifier NOT NULL,
IsDeleted bit NOT NULL CONSTRAINT [DF_PhotoComment_IsDeleted] DEFAULT (0),
CONSTRAINT [PK_PhotoComment] PRIMARY KEY (CommentID),
CONSTRAINT [FK_PhotoComment_PhotoID] FOREIGN KEY (PhotoID) REFERENCES dbo.Photo(PhotoID),
CONSTRAINT [FK_PhotoComment_CreatedBy] FOREIGN KEY (CreatedBy) REFERENCES dbo.aspnet_Users(UserId),
CONSTRAINT [FK_PhotoComment_UpdatedBy] FOREIGN KEY (UpdatedBy) REFERENCES dbo.aspnet_Users(UserId)
)

Design 2: The "Arc" relationship

CREATE TABLE dbo.Comment
(
CommentID int IDENTITY(1,1) NOT NULL,
CommentType char(1) NOT NULL CHECK(CommentType IN ('A','I','E','G','U','P')),
Body ntext NOT NULL,
ReportedAsSpam bit NOT NULL CONSTRAINT [DF_Comment_ReportedAsSpam] DEFAULT (0),
IsSpam bit NOT NULL CONSTRAINT [DF_Comment_IsSpam] DEFAULT (0),
IsApproved bit NOT NULL CONSTRAINT [DF_Comment_IsApproved] DEFAULT (1),
CreatedDate datetime NOT NULL,
CreatedBy uniqueidentifier NOT NULL,
UpdatedDate datetime NOT NULL,
UpdatedBy uniqueidentifier NOT NULL,
IsDeleted bit NOT NULL CONSTRAINT [DF_Comment_IsDeleted] DEFAULT (0),
CONSTRAINT [PK_Comment] PRIMARY KEY (CommentID),
CONSTRAINT [FK_Comment_CreatedBy] FOREIGN KEY (CreatedBy) REFERENCES dbo.aspnet_Users(UserId),
CONSTRAINT [FK_Comment_UpdatedBy] FOREIGN KEY (UpdatedBy) REFERENCES dbo.aspnet_Users(UserId),
CONSTRAINT [UC_Comment_CommentID_CommentType] UNIQUE (CommentID, CommentType)
)

-- Article Comments --
CREATE TABLE dbo.ArticleComment
(
ArticleID int NOT NULL,
CommentID int NOT NULL,
CommentType char(1) CONSTRAINT [DF_ArticleComment_CommentType] DEFAULT 'A', CHECK (CommentType = 'A'),
CONSTRAINT [PK_ArticleComment] PRIMARY KEY CLUSTERED (ArticleID, CommentID),
CONSTRAINT [FK_ArticleComment_ArticleID] FOREIGN KEY (ArticleID) REFERENCES dbo.Article(ArticleID),
CONSTRAINT [FK_ArticleComment_CommentID] FOREIGN KEY (CommentID) REFERENCES dbo.Comment(CommentID),
CONSTRAINT [FK_ArticleComment_CommentID_CommentType] FOREIGN KEY (CommentID, CommentType) REFERENCES dbo.Comment(CommentID, CommentType)
)

Design 3: The one that breaks the rules

CREATE TABLE dbo.Comment
(
CommentID int IDENTITY(1,1) NOT NULL,
ObjectType char(1) NOT NULL, /* A = Article, P = Photo etc... */
XID int NOT NULL, /* Would be the ID of the main entity being queried. */
Body ntext NOT NULL,
ReportedAsSpam bit NOT NULL CONSTRAINT [DF_Comment_ReportedAsSpam] DEFAULT (0),
IsSpam bit NOT NULL CONSTRAINT [DF_Comment_IsSpam] DEFAULT (0),
IsApproved bit NOT NULL CONSTRAINT [DF_Comment_IsApproved] DEFAULT (1),
CreatedDate datetime NOT NULL,
CreatedBy uniqueidentifier NOT NULL,
UpdatedDate datetime NOT NULL,
UpdatedBy uniqueidentifier NOT NULL,
IsDeleted bit NOT NULL CONSTRAINT [DF_Comment_IsDeleted] DEFAULT (0),
CONSTRAINT [PK_Comment] PRIMARY KEY (CommentID),
CONSTRAINT [FK_Comment_CreatedBy] FOREIGN KEY (CreatedBy) REFERENCES dbo.aspnet_Users(UserId),
CONSTRAINT [FK_Comment_UpdatedBy] FOREIGN KEY (UpdatedBy) REFERENCES dbo.aspnet_Users(UserId),
CONSTRAINT [UC_Comment_CommentID_ObjectType_XID] UNIQUE (CommentID, ObjectType, XID)
)
-- Ex: Get all comments for article ID 23.
SELECT * FROM Comment Where ObjectType ='A' and XID = '23'

View 1 Replies

MVC :: Less Aggresive Implementation?

Jan 11, 2010

I like this idea when I don't have to use slow expression compilation to be strongly typed. But the current implementation is too aggresive for me - I hate virtualization my action methods.My question is: Are you planning some (branch) implementation that will not require action method virtualization? I think that most of code could be shared in both branches...

View 2 Replies

SSO Implementation Between OBIEE?

Aug 11, 2010

We have application build in asp.net in which on button we need to go to OBIEE dashboard. Similarly need to come back from OBIEE to ASP.NET application.

Currently I am using redirecting from ASP.net page to OBIEE with username and password in the URL. But as per my requirement i need to implement SSO or username and password should not be passed in URL query string.

View 1 Replies

Architecture :: Articles/Links On Asp.Net Pipeline And Internal Request Processing Architecture?

Oct 4, 2010

I am looking details on the internal working of asp.net architecture. The topics need to include the following:

Asp.Net Thread/Application Pools HttpRuntime HttpApplication - When and how it is set up How HttpContext is set up How objects can passed along the pipeline using HttpContext.Current.Items Why does modification of static variables requires locks in ASP.NET (advanced)IIS 7 Integration Mode

View 1 Replies

How To Do Custom Bind() Implementation

Nov 27, 2010

When using a databound control the Bind() method does some magic to first extract the current value from the datasource and then pass an update back to the datasouce when an update is performed.

Now I have created a custom datasource and am supplying my own custom data which all works fine. For read only the following code works a treat. As you can see I am accessing both a named index into the collection and a property.

Now when using Bind() I cannot find a way to accomplish this. Bind() would appear to look for either an object property or a database row column (not sure how it does this) and I cannot find a way to change this.

It shouldn't be that difficult because the hard part is obtaining the data, which my code below can already do. The changes are passed back as a dictionary which should be simple. But I need a way to write my own bind method and I haven't managed to find out how.

Code:

Surname : <asp:TextBox ID="TextBox2" Text='<%#((MyCustomDataRow)Container.DataItem)["Surname"].EditDataString%>' runat="server" />

View 10 Replies

C# - Implementation Of Event Aggregator?

Mar 13, 2010

I want to use Event Aggregator to allow communication between presenters on the page. I am using currently this implementation http://kentb.blogspot.com/2008/03/event-hub.html. But in asp.net I am not sure about side effects which can occur.

View 1 Replies

Architecture :: How To Design A Centralized Business Or Service Authentication Architecture

Sep 22, 2010

i want to create a centralised business or Service authendication architecture in .net. for example, we have a clients like c1, c2, c3, c4, ... etc. everybody logins seperatly as well as grouply. ie, if client "C1" logins [with login authentication] he can access c2 , c3, c4 also without login authendication. So its like a google. if we enters gmail account, we can access orkut, picasa like that.. i need the cetralised architecture.

And, client "c1" seperately asks seperately how will be the authendication architecture.

so give me the single solution for both these two scenarios. how will be the architecture for these two and how is the Data Base (Login) Structure.

View 3 Replies

Architecture :: Entity Model Design Framework And N - Tier Architecture

Dec 25, 2010

recently i've studied on ADO.NET's Entity Model Framework and say 'wow' as ORM is one of the fevourite pattern i practice..but suddenly i've come to an ambiguous situation when i'm going to start. i usually follow the following 3-tier architecture..

1. UI Layer
2. BLL - business logic layer
3. DAL - Data Access Layer
a. DTO / DAO
b. Gateway (contains the sql query/stored procedure and connection with DB)

now when i'm going to use the Entity Model Design,where the DBML/ .edmx File should be placed? Because many a times i'm using the DBML file as DTO because of the mapped objects.. in the same time, sometimes DBML ( .edmx file in .NET 4.0) contains CRUD methods and stored procedured method as well as methods with different selection operations,- which should be in Gateway. so where the .edmx file should be placed !?!! IN DTO namespace !? or in Gateway namespace!

moreover sometimes there is no need for the BLL which breaks the rules of inter-layer-communication (UI > BLL > DAL.Gateway)! what makes me confuse is, what should be the ideal n-tier architecture when i'll use the ADO.NET Entity Model Design Framework

View 4 Replies

The Proper Use Of EnsureChildControls()?

Sep 21, 2010

Most often I use it when I am accessing a property of a composite control that depends on a child control.But I have also added it to OnInit of a control so I could make sure a hidden field was added correctly. Just a minute ago I called it in RenderControl because I was having an issue rendering a calendar extender and it fixed it. I am starting to get a little confused on when I need to and when I don't need to call EnsureChildControls and when I should call it.

View 2 Replies

AJAX :: AutoCompleteExtender Implementation Guidelines

Jun 1, 2010

use a textbox and the AutoCompleteExtender to search for the customer. For example, on the PurchaseOrder form, I have a textbox with a Customer field, and when I type in the name of the customer, the AutoCompleteExtender shows the possible matches.Now, it takes a few seconds to show the list of values, even with setting the correct values on the extender, and if the user types in the name of the company, e.g. Contoso, and leaves the textbox, there might be 2 Contoso's in the database. The AutoCompleteExtender does not continue when the user leaves the textbox, thus the CustomerId is not determined yet.

View 1 Replies

MVC :: Really An Implementation Of Model - View-Controller?

Feb 8, 2010

In MVCs with which I have worked, the Controller has the job of co-ordinating a number of views, consequent to some user action against the model.

However in ASP MVC, there never appears to be more than 1 view resulting from an http request (please correct me if I am wrong). Instead the "Controller" in ASP MVC appears to be a URL Routing Target.

Also, in my (admittedly limited) experience, the Model in MVC is intended to be a model of the problem domain of the application. However in ASP MVC, the "Model" appears to be a model of the
data binding of the corresponding view.

View 3 Replies

.Net MVC And Comet (ajax Push) Implementation

Jun 8, 2010

I'm trying to implement an auction website and I search in web the Ajax Push is the best way where I can use! So, I'm finding some samples in web to learn how to implement Ajax Push (comet) in client and server. By the way, I find some samples in ASP.Net Webforms, but no in MVC version. I'd like to find a demo, sample, anything ... that use MVC

View 3 Replies

Implementation Of SSL On SaaS App With Separate Domains?

Mar 19, 2010

We are developing a SaaS application in Asp.net, where we have used the Single application and Per Tenant Database. The application is more like a Saas e-commerce where SSL and data separation are required features. Now we want that every Tenant can have his separate top level domain names instead of the second level domains like 37Signals. So all the domains abc.com and xyz.com are using the same single app.

What i need to know is how to implement and deploy the https in the application so that everything works out fine, also how should we configure the NameServer and web application on IIS so that all the domains are pointing to the one application.

View 1 Replies

Google Search Appliance (GSA) Implementation In .Net?

Feb 24, 2011

we are replacing our current search engine with GSA in one of the portal sites. The GSA admin sets up everything we need for (collections, dedicated IP, Indexing). How do i get the results from GSA and format it (results will be in XML) and present to the user like google search results (Title, summary ...) in C#.

View 1 Replies

.NET :: Local Sequence Cannot Be Used In LINQ To SQL Implementation

Nov 2, 2010

I just want to do a select in one SQL SERVER TABLE using LINQ to SQL. And this select statment needs to compare one SQL filed to one hashtable key value.

Dim q = From product In db.productDB _
HashVar As DictionaryEntry In MyHashTableVar, _
Where _
product.productID = HashVar.Key

"Local sequence cannot be used in LINQ to SQL implementation of query operators except the Contains operator"

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved