.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Circular Reference with Complex Type

Posted By:      Posted Date: September 27, 2010    Points: 0   Category :ASP.Net

I have created a webservice that returns a complex type.  This is the xml that is returned from the webservice:

<NinjaRouteEntity xmlns="http://tempuri.org/">
  <Entity NinjaRouteID="1" xmlns="">
    <EntityCollectionReference PropertyName="PointCollectionViaNinjaRouteVector">
        <Entities />

View Complete Post

More Related Resource Links

The type 'DataGrid' was not found. Verify that you are not missing an assembly reference and that

Hi; I'm new to WPF and I was going through the ExpenseIt tutorial on MSDN's website. The tutorial was working fine until I added DataGrid. I got the error message: "The type 'DataGrid' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built."     I could not find a clear answer online of which assembly references to fix and how to fix them. Any help would be appreciated. Thanks!     Note: I'm running the following: Windows Vista 32-bit operating system Microsoft Visual Studio 2008 Version 9.0.30729.1 SP Microsoft .NET Framework Version 3.5 SP1

The type 'DropShadowEffect' was not found. Verify that you are not missing an assembly reference a

We created a grid in Expressions Blend but the DropShadowEffect caused an error for a developer who tried to build the solution and did not have Expressions Blend on his machine.  Had to replace with  <Border.BitmapEffect><DropShadowBitMapEffect ... Are there other incompatibilities between Expressions Blend and plain old Visual Studio 2008 development environs? <   UserControl   xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation   xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml   xmlns:d=http://schemas.microsoft.com/expression/blend/2008   xmlns:mc=http://schemas.openxmlformats.org/markup-compatibility/2006   mc:Ignorable="d"   xmlns:igRibbon=http://infragistics.com/Ribbon   x:Class="TestEditor.Ctrl_PR"   x:Name="UserControl"   MaxWidth="450"   d:DesignWidth="450" d:DesignHeight="125">     <Grid x:Name="LayoutRoot" RenderTransformOrigin="0.5,0.5" Width="450" Height="125">   <Border CornerRadius="8" BorderBrush="DarkSlateBlue" BorderThickness="0.5" HorizontalAlignment="Stretch" Grid.ColumnSpan="2">     <Border.Background>       <LinearGradientB

How do i pass my datacontract into my business layer without a circular reference????

Ok, this architecture is fairly new to me, so I need a few good pointers.  I've searched the topic, but still don't have a clear understanding on what I'm missing.   I have a presentation layer, which displays my data and forms. I have a WCF service, a business layer and a dataAccess Layer I am trying to read data from on OLD!! foxpro .dbf file.  I've read all the articles on why not pass Datasets, etc so I'm trying to learn how to pass data contracts.  I have the following in my WCF [ServiceContract] public interface IService1 { [OperationContract] void SaveNDFData(string storedprocedure, ndfContractLibrary.NDFDataParam[] ndfData); <strong>[OperationContract] List<ndfContractLibrary.NDFDRawData> getRawNDFD();</strong> } I have a separate library for my dataContracts as i know later I will have several.  I'm using this as a generic List<> [Serializable] [DataContract] public class NDFDRawData { private int batchNumber; [DataMember] public int BatchNumber { get { return batchNumber; } set { batchNumber = value; } } private int sampleNumber; [DataMember] public int SampleNumber { get { return sampleNumber; } set { sampleNumber = value; } } private decimal invitroHour; [Da

'Object graph for type 'TYPE' contains cycles and cannot be serialized if reference tracking is d



I have datacontracts as below

  public abstract class ThisClass
    public abstract ThisClass Parent { get; set; }

  public class SomeClass: ThisClass
    public abstract ThisClass Parent { get; set; }


I tried solutions in below blogs


as well as I tried to apply ..[DataContract(IsReferece = true)]

But still i get below error message in SVC trace.

There was an error while trying to serialize parameter http://tempuri.org/:data. The InnerException message was 'Object graph for type 'SomeClass' contains cycles and cannot be serialized if reference tracking is disabled

Anybody has tried above scenario?

Please help, thanks in advance.

Regards, Nakul

using typeof for a reference type


namespace AssemblyA
    public class Product
        private int cinProductID;
        public int ProductID
            get { return cinProductID; }
            set { cinProductID = value; }

        private Array csCategoryName;
        public Array CategoryName
            get { return csCategoryName; }
            set { csCategoryName = value; }

namespace AssemblyA
    public class Categories
        private string csName;
        public string Name

casting to complex type


I'm trying to figure out how to use the combobox item object collection.  Given the code below, how can I put a term in the "Cast<?>" statement to get my anonymous types back?  Or, is there a completely different way to do it?  Can I explicitly cast 'a'?

var citiesbox = new ComboBox();
ComboBox.ObjectCollection objects_to_store = new ComboBox.ObjectCollection(citiesbox);
objects_to_store.Add(new { cityid = 1, cityname = "Eugene" });
objects_to_store.Add(new { cityid = 2, cityname = "Portland" });
objects_to_store.Add(new { cityid = 3, cityname = "Salem" });

var citycode_from_db = 2;

citiesbox.SelectedItem = from a in citiesbox.Items.Cast<?>
             where a.cityid = citycode_from_db
             select a;
-Ethan Nelson

Complex Matrix column data with different data type

I have a data like this

drop table #table
select 34 as A,17948 as B,0.19 as C,19 as D,16145 as E,'Jan' as Period into #table
Insert into #table
select 26 as A,14206 as B,0.18 as C,19 as D,13411 as E,'Feb' as Period
union all
select 38 as A,13037 as B,0.21 as C,18 as D,14974 as E,'Mar' as Period
select * from #table

From this #table i want the view as below format and is doable thru matrix report option in SSRS,but the problem i am running is that i cannot get in this type of data type format. If you look into it,i have column with header 'Jan' and it has data in different data type e.g money,number,percentage. I need to maintain this data type in order to do the calculation after it generates the report on excel spreadsheet. If i use the varchar for the column, it is not usable to me in the final report and i cannot do the calcualtion. Any workaround will be highly appreciated.

    Jan               Feb          Mar
A $34               $26          $26
B 17,

Using Complex Type with Stored Procedure in EF4.0??


Hi All,

Playing with my new toy, VS2010.

  1. Created a .NET 4.0 Web App.
  2. Added Entity Data Model, SPTestModel.edmx, using local AdventureWork SQL Server database, included all tables and one stored procedure.
  3. From the Model Browser>Add Function Import>Choose Stored Proc>Get Column Info>Create New Complex Type>Return a Collection of New Complex Type>OK
  4. Add new WFC Data Service
    1. namespace SPTestDataService
          public class SPTestDataService : DataService<SPTest.AdventureWorksEntities>
              // This method is called only once to initialize service-wide policies.
              public static void InitializeService(DataServiceConfiguration config)
                  config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
                  config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;

QUESTION: How do I use the stored procedure?? The complex type mapped to it is ju

Can not add assembly reference and using .dll file from Visual studio 2008 and 2010 Type 'LibraryN


Hi all,

Please tell me the way to solved my problem to looking for a long time.

My System Info:

OS: Windows 7 - Ultimate - 64bit

VS: Visual Studio 2008 - Professional (and problem with my VS2010 installed)


I have a small project and build it to library .dll file with some function util.

From an other website (with diffirence solution). I added reference the .dll before to website.

In website, I declaration to using the function in library (dll file before). But I found error:  Error 1 Type 'LibraryName' is not defined.

And in VS2010 the problem is same.

But, run website on an other computer, it work normally.

Thanks and Best regards.

Passing a reference type by value and reference


Can somebody explain why this happens ?

1.   If a reference type is passed by reference, the callee may change the values of the object's

     state data as well as the object it is referencing.

2.   If a reference type is passed by value, the callee may change the values of the object's state

     data but not the object it is referencing.


DataAnnotation with .edmx complex type


I have a problem.

In edmx Contact entity PersonalInfo complex type is defined with property FullName and Title.

In view the code is

<div class="editor-label">
                <%: Html.LabelFor(model => model.PersonalInfo.FullName) %>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.PersonalInfo.FullName) %>
                <%: Html.ValidationMessageFor(model => model.PersonalInfo.FullName) %>

Got buddy class like
    public partial class Contact

    public class ContactValidation

        public string FullName { get; set; }

When I submit form get an error of mapping but if I take FullName out of complex type than form is working fine.
How I validate FullName if it is in Complex type?


Service Reference: return type converted to a "ref" parameter



I created a WCF service using Message Contracts. One of the operations in the service takes in an entity (embedded in a message contract) and returns an updated version of the entity:

EWADemo.MessageContracts.CustomersService.SaveCustomersResponseMessage SaveCustomers(EWADemo.MessageContracts.CustomersService.SaveCustomersRequestMessage request);

[MessageContract(WrapperName = "SaveCustomers")]
public partial class SaveCustomersRequestMessage
 public EWADemo.DataContracts.Customers Customers

[MessageContract(WrapperName = "SaveCustomersResponse")]
public partial class SaveCustomersResponseMessage
 public EWADemo.DataContracts.Customers Customers

When I tried creating a s

Parsing string as a Button type reference in Visual c#


So basically, id like to parse the name of a string as an Button reference, and then alter the properties of that particular button with the reference being the same as the string parsed.

something like

Button b101 = new Button();





 private void boxlight(Button obj)
            obj.BackColor = Color.RED;


however explicit type casting for this conversion is not supported.



Saving a complex custom type Variable to ModelItem


I am using a custom designer in a hosted workflow designer and want to use a complex custom type as a variable in a workflow.

I have been able to save the Variable, complete with values set in the designer Popup, in the ModelItem (to be able to save the workflow to a file) using:




sharepoint 2010 custom webservice, visual studio 2010, unable to get reference - content type is tex


I followed the MSDN example in how to create a custom webservice that integrates with sharepoint at http://msdn.microsoft.com/en-us/library/ms464040.aspx

I'm able to successfully call the custom webservice it walks you through from internet explorer out of a sharepoint 2010 site using a URL such as http://vm-spproduction/sites/resource/_vti_bin/service.asmx

And, I'm able to successfully call the same custom webservice from internet explorer out of the same sharepoint 2010 server with the URL http://vm-spproduction/_vti_bin/service.asmx

In Visual Studio 2010 (running on the same hardware server as sharepoint 2010), I am able to bring up the same custom webservice in the add web reference using the advanced buttons of the add service reference dialog.  But, when the custom webservice is found, visual studio reports the following error:

The document at the url http://vm-spproduction/sites/resource/_vti_bin/service.asmx was not recognized as a known document type.
The error message from each known type may help you fix the problem:
- Report from '

SQLXML 4 - How to specify a relationship on repeating element of global complex type


I have tried to create a sample showing the issue.  Basically we have multiple elements that use a global complex type.  This complex type has a repeating element and, therefore, should have another relationship specified for it.  I've tried specifying two relationships on the "Phone" element that reference their respective parents, but that does not work.  Is this scenario supported in SQLXML using SchemaGen?

<?xml version="1.0" encoding="utf-16"?>
<xs:schema version="1.0" xmlns:xs

TreeSelector : playing with generics and type inference

create a generic way to define a selection starting from a tree of objects, the most simpler way as possible.

Let's start with the beginning...
Here is a very simple little interface defining a node of the tree, basically, a value and the references to the child nodes.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend