Hello Everyone -


I apologize in advance as this question may not be very Advanced, but it
doesn't really fit anywhere else, and it sure has me thinking.



I am creating a WinForms app that utilizes a web service for all of its data
layer features.



My solution is comprised of three projects broken out as follows...

1.       A WinForms project called App

a.       A class called Main

b.       A class called LoginForm

2.       A Class Library project called BE (business entities)

a.       A class called Employee

3.       An ASP.NET Web Service project called DAL (data access layer)

a.       A class called EmployeeDalc (data access logic component)


i.      EmployeeDalc has a webmethod called GetEmployeeByUsername(string)
that returns Employee



I think this is pretty straight-forward.  The reason for the BE project is
that both App and DAL deal with objects of type Employee.  Therefore, I
figured I should define the Employee class in a DLL and have App and DAL
each reference the BE.dll.  Also, App also has a web reference to DAL, of
course.



In App, I show a Login form that prompts for username and password.  I then
instantiate an Employee and the EmployeeDalc and call the
GetEmployeeByUsername() method.  Like this...



  <snippet lang="VB">

    Dim login As LoginForm

    login.ShowDialog()



    Dim emp As BE.Employee

    Dim dalc As New EmployeeDalc

    emp = dalc.GetEmployeeByUsername(login.Username) 'This line of code is
not popular

  </snippet>



For the time being, the GetEmployeeByUsername() method simply does this...



  <snippet lang="VB>

  <WebMethod()> _

  Public Function GetEmployeeByUsername(ByVal username As String) As
BE.Employee

    Dim emp As New BE.Employee

    emp.FirstName = "Stuart"

    emp.LastName = "Laughlin"

    emp.SecurityLevel = 256

    Return emp

  End Function

  </snippet>



The problem is the unpopular line of code in my first snippet above.  This
line gives me an error saying that "App.dalcEmployee.Employee cannot be
converted to BE.Employee."



I kind of understand why this is happening.  I know that when I create the
web reference to DAL in App, the Reference.map and Reference.vb files are
generated.  As I understand it, the Reference files define classes that act
as proxies to the web service itself.



I'm just not sure how I should proceed.  Should I hack the Reference.vb
file?  Do I just need to add some attributes to my BE.Employee class?
Should I get rid of the BE.dll altogether?



Any input or reading recommendations will be greatly appreciated by me.



Thanks in advance,





 <mailto:[EMAIL PROTECTED]> Stuart Laughlin


<http://www.fawcette.com/vsm/2003_06/magazine/departments/softwarearchitect/
default.asp> Sr. Developer,  <http://www.affina.com/> AFFINA

(309)679-4289




===================================
This list is hosted by DevelopMentor�  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to