VB重载解析失败

发布于 2024-12-14 02:58:09 字数 2352 浏览 3 评论 0原文

我在编译时遇到这个错误,我不知道为什么~ 任何人都可以解决这个问题。

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>

I having this error during compile and i have no idea why~
Anyone can solve the problem pls.

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

This is the code behind

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

This is the XAML code

<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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

内心荒芜 2024-12-21 02:58:09

mem.NewMem 的类型为 LotusUniversityAd.Lecture,您可能有一个采用 LotusUniversityAd.Web.Lecture 类型的 DomainContext Insert 方法(如果没有,您将需要一个)。

请注意命名空间的差异。如果您解决了这个问题,您的错误可能会得到纠正。如果您已在 silverlight 项目中定义了讲座类,请确保它位于 Web 命名空间内并定义为分部类。

mem.NewMem is of type LotusUniversityAd.Lecture, you likely have a DomainContext Insert method which takes a type of LotusUniversityAd.Web.Lecture (if not you will need one).

Note the difference in namespaces. If you resolve this, your error will likely be rectified. If you have defined the lecture class in your silverlight project, ensure it is within the Web namespace and defined as a partial class.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文