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

  • Home
  • SEARCH
  • 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 6706163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:29:16+00:00 2026-05-26T07:29:16+00:00

I am using linq to SQL as my ORM and then passing linq To

  • 0

I am using linq to SQL as my ORM and then passing linq To Sql objects across a web service to my aspx UI pages.

This has been working fine when I pass straight up Linq to sql objects across, they get serialised and I am able access them as json. And This webservice also work fine when I pass over poco DTO, as some of the data in these objects come from a few different linq to SQL classes.

The problem I have is when I try and use linq to SQL class with extra fields defined in a custom partial class. The fields in my custom side of the partial class do not get across the web service, The fields in the linq to sql generated side of the partial class do come across.

The fields are there when I create the object and I can see them in the visual studio debugger up until they go across the service, but they are not in the json on the other side.

Here is the partial class

using System.Runtime.Serialization;

namespace GPSO.ATOMWebDataLayer.LinqToSql
{
    public partial class Geofence
    {
        public string FillColor { get; set; } 
    }
}

Here is the web service

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
using System.Text;
using System.Web;
using System.Web.Profile;
using System.Web.Security;
using System.Xml;
using GPSO.ATOMWebBusinessLayer;
using GPSO.ATOMWebDataLayer;
using GPSO.ATOMWebDataLayer.LinqToSql;
using GPSO.ATOMWebDataLayer.Objects;
using GPSOnline.ReportWebService;

using Contact = GPSO.ATOMWebDataLayer.LinqToSql.Contact;
using Event = GPSO.ATOMWebBusinessLayer.Event;
using Geofence = GPSO.ATOMWebBusinessLayer.Geofence;

namespace GPSOnline
{
    [ServiceContract(Namespace = "GPSOnline")]
    [ServiceBehavior(IncludeExceptionDetailInFaults = true)]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class ATOMWebService
    {
        private string _atomDbConnectionString;
        private string _aspNetDbConnectionString;
        private string _satelliteDbConnectionString;

        [OperationContract]
        [WebGet]
        public IEnumerable<GPSO.ATOMWebDataLayer.LinqToSql.Geofence> GetAllGeofences()
        {
            NoCache();

            var geofenceRepo = new GeofenceRepository(GetConnectionString());
            return geofenceRepo.GetAllGeofences().ToList();
        }
    }
}

and here is the Repository 

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using GPSO.ATOMWebBusinessLayer;
using GPSO.ATOMWebDataLayer.LinqToSql;
using GPSO.MapUtilities;
using GPSO.Repository;
using Microsoft.SqlServer.Types;
using Geofence = GPSO.ATOMWebBusinessLayer.Geofence;

namespace GPSO.ATOMWebDataLayer
{
    public class GeofenceRepository 
    {
        private static string _connectionString = "";

        public GeofenceRepository(string connectionString)           
        {
            _connectionString = connectionString;
        }
        public IEnumerable<LinqToSql.Geofence> GetAllGeofences()
        {
            var dataContext = new AtomWebDataContext(_connectionString);
            return allGeofences = dataContext.Geofences.ToList();    
        }
}

and here is the ui Page

  <%@ Page Language="C#" MasterPageFile="~/Private/ATOMWEB.master" AutoEventWireup="true"
    Async="true" Inherits="GPSOnline.Assets" Title="ATOM®web Asset Map" CodeBehind="Assets.aspx.cs" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Src="../UserControls/ucAssetPicker_ClientEvent.ascx" TagName="ucAssetPicker"
    TagPrefix="uc1" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderLeft" runat="Server">
    <asp:ScriptManagerProxy ID="ScriptManagerProxy" runat="server">
        <Services>
            <asp:ServiceReference Path="/ATOMWEBService.svc" />
        </Services>
        <Scripts>
            <asp:ScriptReference Path="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=true&amp;client=gme-gpsonline" />
            <asp:ScriptReference Path="~/scripts/MapPanel.js" />
            <asp:ScriptReference Path="~/scripts/jquery-1.3.2.min.js" />
            <asp:ScriptReference Path="~/scripts/AssetLabel.js" />
            <asp:ScriptReference Path="~/scripts/NumberFormatting.js" />
            <asp:ScriptReference Path="~/scripts/DateFormatting.js" />
            <asp:ScriptReference Path="~/scripts/Utilities.js" />
            <asp:ScriptReference Path="~/scripts/geofences.js" />
            <asp:ScriptReference Path="~/scripts/mapUtilities.js" />
        </Scripts>
    </asp:ScriptManagerProxy>
    <script type="text/javascript">
        var map = null,
            atomWebServiceProxy = null,
            selectedAssetId = null,
            userPreferences = null,
            userId = null,
            assets = [],
            assetMarkers = [],
            updatedAssets = [],
            assetStatusPanel = null,
            assetContextItem = null,
            trackAsset = false,
            firstTime = true,
            deviceChannels = { },
            assetPanelLayouts = { },
            geoFences = { };

        function contentPageLoad() {
            atomWebServiceProxy = new GPSOnline.ATOMWebService();
        }

        /// <summary>

        /// <summary>        
        /// calls the webservice to get all the geo fences. 
        /// Runs gotGeoFences when service call successfull
        /// </summary>
        function getGeofences() {
           atomWebServiceProxy.GetAllGeofences(gotGeofences);          
        }


        /// <summary>
        /// Add the collection of geoFences to the page       
        /// </summary>        
        /// <param name="Result"> A collection of GeoFences </param>  
        function gotGeofences(result) {

            geoFences = new GeoFencesObj(map, result, "chkToggleGeofences", "<%=RadContextMenuGotoGeofence.ClientID%>", !userPreferences.DefaultShowGeofences);

            if (userPreferences.DefaultLocationType == 2 && userPreferences.HomeSiteId != null) {
                geoFences.zoomToGeofence(userPreferences.HomeSiteId);
            }
        }
}
  • 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-26T07:29:17+00:00Added an answer on May 26, 2026 at 7:29 am

    You need to use the [DataMemberAttribute]:

    namespace GPSO.ATOMWebDataLayer.LinqToSql
    {
        [DataMember]
        public partial class Geofence
        {
            public string FillColor { get; set; } 
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Linq-to-sql as an ORM. I wrote this innerjoin public IQueryable<Material> FindAllMaterials()
I have been using LINQ to SQL for years now, but this is the
I've been using Linq to SQL for some time now and I find it
I am using linq to sql as ORM for my asp.net mvc website. I
I'm using Linq To Sql to fill up a listbox with Segment objects, where
When using LINQ to SQL am I forced to live with objects structured the
I've been using LINQ to SQL and Entity Framework for a few years and
I am using Linq to Sql as my ORM and I have a list
How to select all columns from tables in join using linq Sql: select CTRL_RUN_JOB.*,
Using LINQ to SQL, I have an Order class with a collection of OrderDetails.

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.