Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8275007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:55:33+00:00 2026-06-08T07:55:33+00:00

Is there a simple way (using code contracts perhaps?) to prevent the use of

  • 0

Is there a simple way (using code contracts perhaps?) to prevent the use of certainl dlls/namespace/assemblies within a given portion of an application?

My use case is that I’d like a warning mechanism when I try to use a company wide service layer within my controllers.

Instead we should have a layer beween that service layer and our controllers (the service layer is changing and we’ll be switching it out bit by bit for our new SDK).

What are some ways of doing this? Can I simply specify somethig in a code contract to warn of the use of a given assembly in the controller methods?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T07:55:37+00:00Added an answer on June 8, 2026 at 7:55 am

    Code Contracts won’t really be useful here.

    Do you have access to Visual Studio Premium or Ultimate? There is a Layer Diagram tool built in, which can be used to validate architecture at build time.

    You create a new Modelling Project and add a Layer Diagram inside that. Then you can drag other projects into the diagram, and you can edit the relationships between them, etc. It’s a very intuitive interface.

    Here’s a blog post explaining how to turn on compile-time verification, and some more information about populating the diagram.

    Here is an example layer diagram. If, for example, code from Business accessed what was inside the Web layer, an error would be generated.

    An example layer diagram
    (source: msdn.com)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to use simple sql queries on ASP MVC without using
Is there a simple way to save a KNN classifier in OpenCV by using
Is there a simple way, using C#, to open an arbitrary URL, read in
Using JQuery, is there a simple way to select the text immediately after a
Using unmanaged C++ on a Windows platform, is there a simple way to detect
following simple code: <li><a href={{ path('_list') }}>List</a></li> is there a simple way to add
Is there a simple way to insert the current time (like TIME: [2012-07-02 Mon
Is there a simple way to serialize a single-level structure as a string for
Is there a simple way, possibly with open-source command line tools in Linux, to
Is there a simple way in Symfony 1.4 to know whether a submitted form

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.