2

コンパイル中にこのエラーが発生しましたが、理由がわかりません〜誰でも問題を解決できます。

Overload resolution failed because no accessible 'Add' can be called with these arguments:
    'Public Sub Add(entity As System.ServiceModel.DomainServices.Client.Entity)': Value of type 'LotusUniversityAd.Lecture' cannot be converted to 'System.ServiceModel.DomainServices.Client.Entity'.
    'Public Sub Add(entity As Web.Lecture)': Value of type 'LotusUniversityAd.Lecture' cannot be converted to 'LotusUniversityAd.Web.Lecture'.  C:\Users\Carson\documents\visual studio 2010\Projects\LotusUniversityAd\LotusUniversityAd\Views\Home.xaml.vb

これは背後にあるコードです

Private Sub addMem_Closed(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim mem As RegistrationPage = sender
            If Not mem.NewMem Is Nothing Then
                Dim _OrganizationContext As OrganizationContext = LectureDataSource.DomainContext
                _OrganizationContext.Lectures.Add(mem.NewMem)

                LectureDataSource.SubmitChanges()

End If

これは XAML コードです

<navigation:Page 
    xmlns:dataForm="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit"
    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"
    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" x:Class="LotusUniversityAd.Home"
    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
    Title="Home"
    xmlns:ds="clr-namespace:LotusUniversityAd.Web"
    Style="{StaticResource PageStyle}" xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices">

<riaControls:DomainDataSource Name="LectureDataSource" QueryName="GetLecture" AutoLoad="True">
            <riaControls:DomainDataSource.DomainContext>
                <ds:OrganizationContext/>
            </riaControls:DomainDataSource.DomainContext>
        </riaControls:DomainDataSource>
    </Grid>
</navigation:Page>
4

1 に答える 1

0

mem.NewMem のタイプは LotusUniversityAd.Lecture です。おそらく、LotusUniversityAd のタイプを取る DomainContext Insert メソッドがあります。Web .Lecture (ない場合は必要になります)。

名前空間の違いに注意してください。これを解決すると、エラーが修正される可能性があります。Silverlight プロジェクトでレクチャー クラスを定義した場合は、それが Web 名前空間内にあり、部分クラスとして定義されていることを確認してください。

于 2011-11-04T16:27:11.003 に答える