New Posts New Posts RSS Feed: Convert An application based on Ria Services
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Convert An application based on Ria Services

 Post Reply Post Reply
Author
joão View Drop Down
Newbie
Newbie
Avatar

Joined: 28-Sep-2010
Location: Portugal
Posts: 5
Post Options Post Options   Quote joão Quote  Post ReplyReply Direct Link To This Post Topic: Convert An application based on Ria Services
    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
 
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post 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.  
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down