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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:24:17+00:00 2026-05-18T21:24:17+00:00

Say I have a web project which uses a WCF service for behind-the-scenes processing,

  • 0

Say I have a web project which uses a WCF service for behind-the-scenes processing, and an MVC 2 project handling web-requests (I guess this will be the WCF client). The WCF service generates data and deals with pre-generated data (the processing will likely happen asynchronously). These two things are separate projects in the same solution in visual studio.

Now, I’m not sure where to put the data structures representing stuff that the service generates, and stuff that the client needs to process and send to users’ browsers. Currently they’re all in the service’s interface (endpoint interface? Not sure what it’s called exactly) marked with [DataContract] (not sure what that does yet). But, since the MVC app is in a separate project, I’d have to re-define all the data structures there — is that necessary? Should I be putting these structures elsewhere in the solution? The interface is getting pretty full of class definitions — am I able to make some sort of shared resource containing the shared data structures between the projects? What about the [DataContract] part — do I still need to stuff that in the interface somehow if the classes are defined somewhere else?

Apologies if I’m not quite making sense or being very vague. I’ve never used these Microsoft technologies before so I’m still pretty lost. I’m just learning as I go.

  • 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-18T21:24:17+00:00Added an answer on May 18, 2026 at 9:24 pm

    Put your data objects in another, separate project (select Class Library when creating it) and reference them from both WCF and MVC2 (duplication aside, I don’t think it will be possible to get it to work otherwise).

    [DataContract] has to be used to decorate the data object classes, no matter where they are.

    I am not sure what you mean when saying “What about the [DataContract] part — do I still need to stuff that in the interface somehow”… can you provide some sample code?

    For reference, here’s some code from a project I worked on in the past:

    This is in project Server.Contracts:

    namespace Server.Contracts.DataContracts.Mapped
    {
        using System;
        using System.Runtime.Serialization;
    
        [DataContract]
        public class ConfigSetting : BindableDataContract
        {
            [DataMember]
            public string Name { get; set; }
    
            [DataMember]
            public string Value { get; set; }
    
            [DataMember]
            public DateTime ModifiedOn { get; set; }
    
            public override object Clone()
            {
                return new ConfigSetting
                       {
                           ModifiedOn = this.ModifiedOn,
                           Name = this.Name,
                           Value = this.Value,
                       };
            }
        }
    }
    

    This is also in Server.Contracts:

    namespace Server.Contracts.ServiceContracts
    {
        using System;
        using System.Net.Security;
        using System.ServiceModel;
        using Common.Constants.ServiceModel;
        using Common.LogClient;
    
        /// <summary>
        /// Interface that defines the log service contract.
        /// </summary>
        [ServiceContract(
        Name = ServiceContract.LogServiceName,
        Namespace = ServiceContract.LogServiceNamespace,
        ProtectionLevel = ProtectionLevel.None, 
        SessionMode = SessionMode.NotAllowed)]
        public interface ILogService
        {
            [OperationContract(Name = "Deferred", IsOneWay = true)]
            void Deferred(LogSeverity severity, DateTime eventTimeUtc, string actor,
                          uint? deviceId, string message, string stackTrace);
        }
    }
    

    This project is referenced from these two other projects, among others:

    • Client
    • Server.Implementation (where e.g. ILogService is implemented)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have 3 projects: 1 Web Project which is in .NET MVC3
Say I have an application with the following structure. // ASP.NET MVC (Web Project)
In a web project using jsp, I have following requirement Upload a file (say
Say I have a web component that uses jQuery and I want to distribute
Say I have a web service where I want to serve the content only
I have a project using WCF which was working fine, but I moved the
We have a hybrid WCF and ASMX web service currently being used on a
I have a web project which the folders are constructed within the areas .
Say we have project that requires web scraping. (parsing strings (< 40) and scraping
Let's say we have 2 projects with following layout Project web global.asax (I thought

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.