okay, finally got it, this was a huge pain and here's the post that started it all because i actually thought my linq to sql was off when it turned out to be entirely different.
definitely check the last entry of this post here:
http://www.vbforums.com/showthread.php?t=620770
as for the code required, included below is the client side codebehind:
and then finally the domainservice code as well - the key is the final function and the invoke tag:Code:Imports System.ServiceModel.DomainServices.Client Imports EstimatorSilverlight.Web Partial Public Class MainPage Inherits UserControl Dim context = New LoginContext() Dim invokeop As InvokeOperation(Of Integer) Public Sub New() InitializeComponent() End Sub Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnLogin.Click Dim username As String = tbUserName.Text Dim password As String = pbPassword.Password invokeop = context.countloginsmatching(username, password) AddHandler invokeop.Completed, AddressOf invokeOperation_Completed End Sub Private Sub invokeOperation_Completed(ByVal Sender As Object, ByVal E As EventArgs) Label3.Content = invokeop.Value End Sub Private Sub LoginDomainDataSource_LoadedData(ByVal sender As System.Object, ByVal e As System.Windows.Controls.LoadedDataEventArgs) Handles LoginDomainDataSource.LoadedData If e.HasError Then System.Windows.MessageBox.Show(e.Error.ToString, "Load Error", System.Windows.MessageBoxButton.OK) e.MarkErrorAsHandled() End If End Sub End Class
once again, a special thanks to techgnome for all the insight.Code:Option Compare Binary Option Infer On Option Strict On Option Explicit On Imports EstimatorSilverlight.Web Imports System Imports System.Collections.Generic Imports System.ComponentModel Imports System.ComponentModel.DataAnnotations Imports System.Data Imports System.Linq Imports System.ServiceModel.DomainServices.EntityFramework Imports System.ServiceModel.DomainServices.Hosting Imports System.ServiceModel.DomainServices.Server 'Implements application logic using the LoginEntities context. ' TODO: Add your application logic to these methods or in additional methods. ' TODO: Wire up authentication (Windows/ASP.NET Forms) and uncomment the following to disable anonymous access ' Also consider adding roles to restrict access as appropriate. '<RequiresAuthentication> _ <EnableClientAccess()> _ Public Class LoginService Inherits LinqToEntitiesDomainService(Of LoginEntities) 'TODO: ' Consider constraining the results of your query method. If you need additional input you can ' add parameters to this method or create additional query methods with different names. 'To support paging you will need to add ordering to the 'logins' query. <Query(IsDefault:=True)> _ Public Function GetLogins() As IQueryable(Of login) Return From login In Me.ObjectContext.logins Order By login.username End Function Public Sub InsertLogin(ByVal login As login) If ((login.EntityState = EntityState.Detached) _ = false) Then Me.ObjectContext.ObjectStateManager.ChangeObjectState(login, EntityState.Added) Else Me.ObjectContext.logins.AddObject(login) End If End Sub Public Sub UpdateLogin(ByVal currentlogin As login) Me.ObjectContext.logins.AttachAsModified(currentlogin, Me.ChangeSet.GetOriginal(currentlogin)) End Sub Public Sub DeleteLogin(ByVal login As login) If (login.EntityState = EntityState.Detached) Then Me.ObjectContext.logins.Attach(login) End If Me.ObjectContext.logins.DeleteObject(login) End Sub <Invoke()> _ Public Function countloginsmatching(ByVal username As String, ByVal password As String) As Integer Dim credentials As List(Of login) credentials = Me.ObjectContext.logins.Where(Function(t) t.username = username AndAlso t.password = password).ToList() Return credentials.Count End Function End Class




Reply With Quote