Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio
This is the forum to discuss the Wrox book ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solution by Vincent Varallo; ISBN: 9780470396865
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 12th, 2009, 09:41 AM
Registered User
 
Join Date: Mar 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter2: IENTBaseEntity Implementation

I am currently reading this book and am trying to write it in VB.NET and I have a question about the IENTBaseEntity Implementation on page 43.

The main idea (what i understand of it) is that the auto generated code from the HRPaidTimeOff.dbml should ideally not be modified by the user, but we want the ENTUserAccount to implement the IENTBaseEntity interface.

The C# code:
Code:
public partial class ENTUserAccount : IENTBaseEntity { }
The VB code (i think this is correct):
Code:
 
Partial Public Class ENTUserAccount
    Implements IENTBaseEntity
End Class
When i have this code (the vb version) in the CustomizedEntities.vb
I get the error of IntelliSense that this class does not implement the interface properties, because the concerning properties do not append the
Code:
 Implements Framework.IENTBaseEntity.InsertDate
I dont know if this is a requirement in C# (to append the above code) but how can i fix this error without modifying the HRPaidTimeOff.dbml code?

If I let IntelliSense implement this Interface, it renames the concerning properties to InsertDate1, InsertENTUserAccountID1 and so on, or is this the purpose of the partial class?

Thanks in advance
Haegendoorn

Last edited by Haegendoorn; July 12th, 2009 at 09:43 AM..
 
Old July 21st, 2009, 03:35 AM
Registered User
 
Join Date: Jul 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Did you fix your issue ? I have the same problem.
 
Old July 21st, 2009, 04:59 AM
Registered User
 
Join Date: Mar 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Docter View Post
Did you fix your issue ? I have the same problem.
Someone (i cant find his post in the thread) gave me the advice to set the auto-generated code in a separate C# project.

This is because C# allows implicit interface implementation and VB doesn't (only explicit implementation). What I did was copy the auto-generated code (still in VB) to a separate .vb file and change it there. But i am not sure if that is a proper solution in the long term.

Try out both solutions and see what works best for you, and let me know!

Haegendoorn
 
Old September 24th, 2009, 04:17 AM
Registered User
 
Join Date: Sep 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default RE: Chapter2: IENTBaseEntity Implementation

All,

Haegendoorn do you still have the issue you describe?

I had the same issue. The problem is that you need to use "Overloads" in the interface "IENTBaseEntity".

Code:
Imports System.Data.Linq

Namespace Framework

    Public Interface IENTBaseEntity

        Overloads Property InsertDate() As Date

        Overloads Property InsertENTUserAccountId() As Integer

        Overloads Property UpdateDate() As Date

        Overloads Property UpdateENTUserAccountId() As Integer

        Overloads Property Version() As Binary

    End Interface
End Namespace
This sorts out the issue you describe.
------------------------------------------

Unfortunate, I got an other issue also related to page 43 at the bottom...
...Now create a data class that handles the ENTUserAccount entity object. Create a class to the framework folder called ENTUserAccountData. The class should be made public and should inherit from ENTBaseData.

Code:
' Class ENTUserAccountData
Imports System.Data.Linq

Public Class ENTUserAccountData
    Inherits ENTBaseData(Of ENTUserAccount)

' Class ENTBaseData 

Imports V2.PaidTimeOffDAL.Framework

Public MustInherit Class ENTBaseData(Of T As IENTBaseEntity)
   
' Customized Entities which contains the partial class ENTUserAccount

Imports V2.PaidTimeOffDAL.Framework

Namespace V2.PaidTimeOffDAL

    Partial Public Class ENTUserAccount
        Implements IENTBaseEntity
No the problem I have is blue line under ENTUserAccount in the class ENTUserAccountData. It states: "Type argument 'V2.PaidTimeOffDAL.ENTUserAccount' does not inherit from or implement from the contraint type 'V2.PaidTimeOffDAL.Framework.IENTBaseEntity' "'

It looks somehow that it doesn't see my partial class ENTUserAccount which implements IENTBaseEntity?

I'm stuck on this quite a while so help would be much appreciated!

Cheers!
Wouter
 
Old September 24th, 2009, 04:44 AM
Registered User
 
Join Date: Mar 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
No the problem I have is blue line under ENTUserAccount in the class ENTUserAccountData. It states: "Type argument 'V2.PaidTimeOffDAL.ENTUserAccount' does not inherit from or implement from the contraint type 'V2.PaidTimeOffDAL.Framework.IENTBaseEntity' "'

It looks somehow that it doesn't see my partial class ENTUserAccount which implements IENTBaseEntity?

I'm stuck on this quite a while so help would be much appreciated!

Cheers!
Wouter
I dont know a specific answer to your problem, but what I did was the following: Delete the interface related properties in the auto-generated file, and rewrite them in the partial class and append the Implements Interface...

Hopes this helps,
 
Old September 24th, 2009, 04:50 AM
Registered User
 
Join Date: Mar 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If you want I can email you the files I got (until Chapter 6 or so)
mail me at haegendoorn (email AT char) base (dot) be

With kind regards,




Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter2: Compilation Error. krytonx85 BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio 2 June 18th, 2009 08:14 PM
Chapter2 netblue BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 2 June 5th, 2007 01:19 AM
Chapter2:problem in rendering weather table samouille666 JSP Basics 0 January 17th, 2007 10:50 AM
Question for Chapter2 NameSpace and Fold structure lovehorse BOOK: ASP.NET Website Programming Problem-Design-Solution 1 October 16th, 2006 08:21 AM
Compiled error of executing chapter2 source code williamlin BOOK Beginning Linux Programming, 3rd Edition 10 August 25th, 2006 10:23 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.