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 6824479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:54:23+00:00 2026-05-26T21:54:23+00:00

So, I am trying to get started with UML class diagrams and as a

  • 0

So, I am trying to get started with UML class diagrams and as a sort of exercise I am trying to model some existing code. Lets say I have this:

public interface IDataContextWrapper : IDisposable
{
     //blah blah blah
}

public class DataContextWrapper<T> : IDataContextWrapper where T : DataContext, new()
{
     //blah blah blah
}

public class ArtistRepository
{
     L2SDCWrapper.Interfaces.IDataContextWrapper dataContext;

     public ArtistRepository()
         : this(new DataContextWrapper<ChinookDataContext>())
     {
     }

     public ArtistRepository(IDataContextWrapper dc)
     {
         dataContext = dc;
     }

     //blah blah blah
}

I’ve come up with this:

done using visual studio modeling tools

My concerns:

  • How do I properly diagram the constructor injection (I think that is what you would call it) in the ArtistRepository class? I feel like my diagram doesn’t accurately represent it.
  • How do I properly diagram the class declaration of DataContextWrapper?
  • 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-05-26T21:54:23+00:00Added an answer on May 26, 2026 at 9:54 pm

    It is generally not a good idea to try to represent every detail of an implementation in UML. UML is better for describing design, and there is to my knowledge no standardized UML profile (= adaptation) for C#, or indeed most other languages.

    That said, here’s a couple of pointers:

    1. Dependencies are rather weak, unspecific connections. The two
      Interfaces should be connected by a Generalization (inheritance).
    2. UML allows for representation of generics / templates / parameterized classes. The specifics of modelling such classes depend on the tool you’re using.
    3. The parameterless ArtistRepository constructor actually creates an object of an anonymous class. You can represent that class in the class diagram if you wish, but if you really want to get into that level of detail it is probably better to draw a sequence diagram for the constructor.

    Here’s a class diagram along those lines, drawn in Sparx Systems’ Enterprise Architect: enter image description here

    Note the parameterized DataContextWrapper and the abstract DataContext. It wasn’t included in the code sample but I assumed it’s an abstract class; if it is in fact an interface the relationship should be a Realization rather than a Generalization.

    I’ve modelled two versions of ArtistRepository, one using an attribute and one using a directed association to represent the dc member. These two are semantically equivalent in UML.

    I’ve only drawn the dependencies to DataContextWrapper and ChinookDataContext from one of them, but that’s just so this example doesn’t get too cluttered; whichever representation you choose should have both relationships of course.

    I have not modelled the anonymous class created by the ArtistRepository constructor. For an overview I think this is plenty.

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

Sidebar

Related Questions

I am trying to get started with scons . I have Python 3.0.1 and
i'm trying to get started with silverlight 2. i have a weird bug. every
I am trying to get started doing some Silverlight development. I am interested in
I am trying to get started with South. I had an existing database and
I'm trying to get started using agsXMPP , but I'm having some problems. I'm
I'm trying to get started with Django, and have previously worked with CakePHP, and
Trying to get started with subsonic but have a simple question about stored procedures
I trying to get started with Google Perf Tools to profile some CPU intensive
I'm trying to get started using git, but I'm having some troubles right away.
I am trying to get started with some basic Ocaml programming. To start I

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.