Print Page | Close Window

Convert An application based on Ria Services

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2229
Printed Date: 06-Jul-2026 at 11:22pm


Topic: Convert An application based on Ria Services
Posted By: joão
Subject: Convert An application based on Ria Services
Date Posted: 14-Oct-2010 at 4:20am

Hi everybody,

I'm testing and learning Devforce. I have a small application with several modules developed in Ria Services under Prims Pattern.

in order to convert all application I'm converting one module at a time.

When i test a single  converted  module in a simple  SilverLight DevForce Application it runs well.

However when I try to run that same module within my prism infrastructure I get always errors related to "KnownTypes"

My question is: 

  Modules written in Ria Services Cannot coexist  with modules written in DevForce?

    If so why i get allways strange erros?
 
 
 

Example : my login Module in DevForce:

 

private void LoginCommand( object iView )

{

   LoginManager.ConnectAsync (op =>

           {

             ILoginCredential credential = new FormsAuthenticationLoginCredential(userName, Password, "demo", false);

           this.CurrentLoginOperation = LoginManager.LoginAsync(credential, LoginCompleted, null);

          });

           

        }

 

    private void LoginCompleted(IdeaBlade.EntityModel.LoginOperation args)

    {

 

        if (args.CompletedSuccessfully)

        {

        }

        else if (args.HasError)

        {

            //allways this error

     //"Type 'erp.Web.Services.MenuItem' cannot be added to list of known types since another type     'erp.Web.Services.MenuItem' with the same data contract name 'http://schemas.datacontract.org/2004/07/erp.Web.Services:MenuItem' is already present."     

 

        }

        else if (!args.Cancelled)

        {

        }

 

    }

 

 

 

'erp.Web.Services.MenuItem' –is a class in another module based in Ria Services

This has nothing to do with the Login module.

 

 

 

 

 

//-------------------

  

 

 

using System;

using System.Collections.Generic;

using System.ComponentModel.DataAnnotations;

using System.Data;

using System.Linq;

using System.Runtime.Serialization;

using System.ServiceModel.DomainServices.Hosting;

using System.ServiceModel.DomainServices.Server;

using System.Web;

using Eticadata.Platinum;

 

namespace erp.Web.Services

{

    [RequiresAuthentication]

    [EnableClientAccess()]

    public class NavigationStructureService : DomainService

    {

        [Query]

        public IQueryable<MenuItem> GetNavigationStructure()

 

        [Query]

        public IQueryable<moduledef> GetModulesToLoad()

    }

 

 

    public sealed partial class moduledef

    {

        [Key]

        public string modulename { get; set; }

 

        public string typename { get; set; }

    }

 

 

    public sealed partial class MenuItem

    {

        public MenuItem()

        {

            this.Region = "MainRegion";

            this.Items = new List<MenuItem>();

        }

 

        [Key]

        public string Key { get; set; }

 

        [DataMember]

        public string Text { get; set; }

 

        [DataMember]

        public string ModuleName { get; set; }

 

        [DataMember]

        public string ModuleType { get; set; }

 

        [DataMember]

        public bool IsSeparator { get; set; }

 

        [DataMember]

        public string ViewName { get; set; }

 

        [DataMember]

        public string Region { get; set; }

 

        [DataMember]

        [Include]

        [Association("Items", "Key", "ParentKey")]

        public List<MenuItem> Items { get; set; }

 

        [DataMember]

        public string ParentKey { get; set; }

 

 

    }

 

    public sealed partial class TabelasPesquisa

    {

        public TabelasPesquisa()

        {

            this.Items = new List<TabelasPesquisa>();

            this.ItemsLista = new List<ListaPesquisas>();

        }

 

        [Key]

        public string Key { get; set; }

 

        [DataMember]

        public string Text { get; set; }

 

        [DataMember]

        public string Command { get; set; }

 

        [DataMember]

        [Include]

        [Association("Items", "Key", "ParentKey")]

        public List<TabelasPesquisa> Items { get; set; }

 

        [DataMember]

        public string ParentKey { get; set; }

 

        [DataMember]

        public List<ListaPesquisas> ItemsLista { get; set; }

 

    }

 

    public sealed partial class ListaPesquisas

    {

        public ListaPesquisas()

        {

        }

 

        [DataMember]

        public Guid id { get; set; }

 

        [DataMember]

        public string CommandName { get; set; }

 

        [DataMember]

        public string Nome { get; set; }

 

        [DataMember]

        public bool PorDefeito { get; set; }

 

        [DataMember]

        public bool ListaPersonalizada { get; set; }

 

    }

}

 

//----------------------------------
 
Thanks in advance,
João salgado
 



Replies:
Posted By: kimj
Date Posted: 17-Oct-2010 at 4:25pm
DevForce is being a little too aggressive in its known type probing here.  In this case it's found your POCO types for RIA, but thinks they're also POCO types for DevForce.  You can control the assemblies included in probing by using the CompositionHost:
 
CompositionHost.SearchPatterns.Clear();
CompositionHost.SearchPatterns.Add(...);
 
You'll likely need to clear and set your own search pattern(s) in both the web and applicaton projects.  In the web project, add the code to the global.asax.  In the SL application, add the code to the app.xaml code-behind or early in your processing before you either create an EntityManager or access the IdeaBladeConfig.  



Print Page | Close Window