I find this problem with the new version of the ORM (2012.2.816.1), everytime when I try to do a reverse mapping.
For example, I created a Table named "person". I used the Domain Model Wizard then the Domain Service Wizard.
I compile the solution I get this issue:
Parameter 'person' of domain method 'DeletePeople' must be an entity type exposed by the DomainService.
The entity type can be exposed either directly in a query operation, or indirectly through an association.
Regards,
Maher Jendoubi.
5 Answers, 1 is accepted
ExceptionString:
System.SystemException: Unable to load assembly 'poc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' : Could not load file or assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. General Exception (Exception from HRESULT: 0x80131500) ---> System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at Telerik.OpenAccess.Metadata.MetadataAttributesReader.PrepareMetaModelTypes(Assembly assembly)
--- End of inner exception stack trace ---
at Telerik.OpenAccess.Metadata.MetadataAttributesReader.PrepareMetaModelTypes(Assembly assembly)
at Telerik.OpenAccess.Metadata.MetadataAttributesReader.ReadMetaModel(Assembly assembly)
at Telerik.OpenAccess.Metadata.AttributesMetadataSource.<>c__DisplayClass1.<FromAssembly>b__0()
at Telerik.OpenAccess.Metadata.AttributesMetadataSource.CreateModel()
at Telerik.OpenAccess.Metadata.MetadataSource.GetModelCore(MetadataContainer old)
at Telerik.OpenAccess.Sdk.Enhancer.Enhancer.CrossDomainRunImpl(AssemblyLoader assemblyLoader)
at Telerik.OpenAccess.Sdk.Enhancer.EnhancerBase.CrossDomainRun()
Can you please also share with us the code of your domain service? This exception might be caused by several issues with your code.
For once the problem might be caused by trying to use a class that is not exposed to a given consumer that has not been previously exposed to the consumer itself. In order to expose that class you will need to have a method that is returning an IQueriable of that type.
Additionally it is possible that the primary key of your class cannot successfully be inferred and you need to mark it with the [Key] attribute so that the class is successfully exposed to the client.
Petar
the Telerik team
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Data;
using System.Linq;
using System.ServiceModel.DomainServices.Hosting;
using System.ServiceModel.DomainServices.Server;
using Telerik.OpenAccess;
using poc.Web;
#pragma warning disable 1591
namespace poc.Web
{
[EnableClientAccess()]
public partial class pocDomainService : OpenAccessDomainService<pocEntitiesModel>
{
public pocDomainService() : base()
{
}
public IQueryable<IM_DOSSIER> GetIM_DOSSIERs()
{
return this.DataContext.IM_DOSSIERs;
}
public void DeleteIM_DOSSIERs(IM_DOSSIER iM_DOSSIER)
{
// This is a callback method. The actual Delete is performed internally.
}
public void UpdateIM_DOSSIERs(IM_DOSSIER iM_DOSSIER)
{
// This is a callback method. The actual Update is performed internally.
}
public void InsertIM_DOSSIERs(IM_DOSSIER iM_DOSSIER)
{
// This is a callback method. The actual Insert is performed internally.
}
public IQueryable<IM_MALAD> GetIM_MALADs()
{
return this.DataContext.IM_MALADs;
}
public void DeleteIM_MALADs(IM_MALAD iM_MALAD)
{
// This is a callback method. The actual Delete is performed internally.
}
public void UpdateIM_MALADs(IM_MALAD iM_MALAD)
{
// This is a callback method. The actual Update is performed internally.
}
public void InsertIM_MALADs(IM_MALAD iM_MALAD)
{
// This is a callback method. The actual Insert is performed internally.
}
public IQueryable<MEDEC> GetMEDECs()
{
return this.DataContext.MEDECs;
}
public void DeleteMEDECs(MEDEC mEDEC)
{
// This is a callback method. The actual Delete is performed internally.
}
public void UpdateMEDECs(MEDEC mEDEC)
{
// This is a callback method. The actual Update is performed internally.
}
public void InsertMEDECs(MEDEC mEDEC)
{
// This is a callback method. The actual Insert is performed internally.
}
}
}
#pragma warning restore 1591
Is that the entire data service? I cannot see anywhere a Person type? Is it possible that one of the classes you have exposed (IM_DOSSIER , IM_MALAD , MEDEC) has a reference to the person type? If that is the case then you will need to also have a method similar to this:
public
IQueryable<Person> GetPersons()
{
return
this
.DataContext.Persons;
}
All the best,
Petar
the Telerik team