У меня нет большого опыта в области абстракции веб-сервисов/базы данных для Silverlight, и я попал в аспект моего усилия по переносу. В проекте был основной разработчик C#, который больше не задействован, и я работаю с кодом, который он написал.Быстрые вопросы об обновлении кода из служб RIA Июль Предварительный просмотр для RIA Services 1.0
Я обновляю код в проекте SL3 с версией предварительного просмотра RIA Services для SL4 с RIA Services 1.0. Я ссылающийся на файл RIA_Services_Breaking_Changes.doc для моего кода усилия преобразования из этого URL: http://code.msdn.microsoft.com/RiaServices/Release/ProjectReleases.aspx?ReleaseId=3570
Моего зависания является то, что я думаю, что это потенциально автоматически сгенерированный файл, и ошибки, связанные с RIA Services EntityCollection/EntityState вещь.
HerculesModel.metadata.cs (Перед началом преобразования)
namespace Everest.Domain.Hercules
{
using System;
using System.ComponentModel.DataAnnotations;
using System.Web.Ria;
using System.Web.Ria.Data;
using System.Web.DomainServices;
using System.Data;
using System.Data.Objects.DataClasses;
// The MetadataTypeAttribute identifies AuthenticationTypesMetadata as the class
// that carries additional metadata for the AuthenticationTypes class.
[MetadataTypeAttribute(typeof(AuthenticationTypes.AuthenticationTypesMetadata))]
public partial class AuthenticationTypes
{
// This class allows you to attach custom attributes to properties
// of the AuthenticationTypes class.
//
// For example, the following marks the Xyz property as a
// required field and specifies the format for valid values:
// [Required]
// [RegularExpression("[A-Z][A-Za-z0-9]*")]
// [StringLength(32)]
// public string Xyz;
internal sealed class AuthenticationTypesMetadata
{
// Metadata classes are not meant to be instantiated.
private AuthenticationTypesMetadata()
{
}
public EntityState EntityState;
public EntityCollection<LoginAccounts> LoginAccounts;
public int TypeId;
public string TypeName;
}
}
...
}
Я обновил с помощью ссылки на новые пространства имен, перечисленных в преломлении изменяет док выше, и испытывал сборку. Visual Studio затем перечислены на следующие ошибки 274 раз в документе:
Error 53 'EntityCollection' is an ambiguous reference between 'System.ServiceModel.DomainServices.Client.EntityCollection<Everest.Domain.Hercules.BookmarkedProfiles>' and 'System.Data.Objects.DataClasses.EntityCollection<Everest.Domain.Hercules.BookmarkedProfiles>' C:\...\Everest.Domain.Hercules\HerculesModel.metadata.cs 872 11 Everest.Domain.Hercules
Error 189 'EntityState' is an ambiguous reference between 'System.ServiceModel.DomainServices.Client.EntityState' and 'System.Data.EntityState' C:\...\Everest.Domain.Hercules\HerculesModel.metadata.cs 3501 11 Everest.Domain.Hercules
Я обновил код, добавив спецификатор устранить неоднозначность:
namespace Everest.Domain.Hercules
{
using System;
using System.ComponentModel.DataAnnotations;
using System.ServiceModel.DomainServices.Server;
using System.ServiceModel.DomainServices.Hosting;
using System.ServiceModel.DomainServices.Client;
using System.ServiceModel.DomainServices;
using System.Data;
using System.Data.Objects.DataClasses;
[MetadataTypeAttribute(typeof(AuthenticationTypes.AuthenticationTypesMetadata))]
public partial class AuthenticationTypes
{
internal sealed class AuthenticationTypesMetadata
{
private AuthenticationTypesMetadata()
{
}
public System.ServiceModel.DomainServices.Client.EntityState EntityState;
public System.ServiceModel.DomainServices.Client.EntityCollection<LoginAccounts> LoginAccounts;
public int TypeId;
public string TypeName;
}
}
...
}
После попытки построить код я получаю следующая общая ошибка в 160 раз, и я полностью застрял на этих ошибках TEntity:
Error 28 The type 'Everest.Domain.Hercules.Authentication.LoginAccounts' cannot be used as type parameter 'TEntity' in the generic type or method 'System.ServiceModel.DomainServices.Client.EntityCollection<TEntity>'. There is no implicit reference conversion from 'Everest.Domain.Hercules.Authentication.LoginAccounts' to 'System.ServiceModel.DomainServices.Client.Entity'. C:\...\Everest.Domain.Hercules\Authentication\AuthenticationModel.metadata.cs 358 85 Everest.Domain.Hercules
Я Resharper установленной для Visual Studio 2010, и в нем говорится, что только с помощью директивы, которые используются документом, - System и System.ComponentModel.DataAnnotations. Насколько я понимаю, файлы * .metadata.cs генерируются автоматически, но как я могу восстановить файл метаданных с поддержкой этой новой версии служб RIA? В этом проекте используется MVVM с открытым исходным кодом.
Благодарим миллион за любую помощь, которую вы можете мне предоставить !!!