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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:03:23+00:00 2026-06-11T03:03:23+00:00

I am having a real issue, and I know that it is because I

  • 0

I am having a real issue, and I know that it is because I just don’t know enough. I have searched through about 50 articles and cannot find an answers.

Here are my domain models

Namespace Models
    Public Class Article
        Public Property ArticleId As Integer
        Public Property Author As String

        <DisplayFormat(DataFormatString:="{0:D}")>
        Public Property CreatedOn As DateTime

        <DisplayFormat(DataFormatString:="{0:D}")>
        Public Property LastModified As DateTime

        <AllowHtml()>
        Public Property Content As String
        Public Property Title As String
        Public Property Excerpt As String
        Public Property IsPublic As Boolean

        Public Overridable Property Category As ICollection(Of Category)
        Public Overridable Property Tags As ICollection(Of Tag)
        Public Overridable Property Status As ICollection(Of Status)
        Public Overridable Property Comments As ICollection(Of Comment)
    End Class
End Namespace


Namespace Models
    Public Class Status
        Public Property StatusId As Integer
        Public Property Name As String

        Public Overridable Property Articles As ICollection(Of Article)
    End Class
End Namespace


Namespace Models
    Public Class Category
        Public Property CategoryId As Integer
        Public Property Name As String

        Public Overridable Property Articles As ICollection(Of Article)
    End Class
End Namespace

Namespace Models
    Public Class Tag
        Public Property TagId As Integer
        Public Property Name As String

        Public Overridable Property Articles As ICollection(Of Article)
    End Class
End Namespace

Here is my ViewModel (based on my domain model)

Namespace ViewModels.Admin
    Public Class ArticleViewModel
        Public Property Article As Article
        Public Property CategoryId As Integer
        Public Property StatusId As Integer
        Public Property Tags As ICollection(Of Tag)
    End Class
End Namespace

I dont know how to save with all of these data crossing patterns. I have tried so many ways now, I do not know where to look. I have tried a few books, but no one really digs into this. I also look at the Contoso University project, but it does not seem like my project. Can anyone help?

  • 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-11T03:03:25+00:00Added an answer on June 11, 2026 at 3:03 am

    If you are using the Entity Framework to do your DAL, you can do this quite easily. Simply build the object from the top down. So in your example, get the article from the ViewModel and populate its navigation properties from the other parts of the View Model.

    Don’t worry about wiring up the navigation properties of the sub objects.

    You can then add this article to the context using AddObject on the articles collection and all the sub properties should insert and wire up too.

    Beware of the sub properties that might already exist in the Db, I have seen EF do inserts on those items even though they have Ids rather than just updating the mapping table etc.

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

Sidebar

Related Questions

I know that similar questions have been asked, but having read through them it
I'm having an issue with running Subsonic in medium trust and don't know if
I have been having this issue for a while now and I cannot seem
I am having real difficulty getting my head around the issue of setting the
I am having real trouble with provisioning and code signing issues. I have migrated
I'm having real problems getting PDO_MYSQL working. I started by just trying to install
I've been having real problems trying to get a ruby script to run through
I have a Google spreadsheet and I am having real difficulty trying to work
I have been having some real trouble with this for a while. I am
I just recently read about Mocking objects for unit testing and currently I'm having

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.