Question

Cannot implicitly convert type

Asked by: Samantha1667

Hi Experts!
I keep getting the error "Cannot implicitly convert type 'System.Collections.Generic.List<CPMS_DAL.tbl_Account>' to 'System.Collections.Generic.List<CPMS_DAL.cl_Accounts>'" for the below code and I can't make out why.  Please help!

Thanks.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq;
 
namespace CPMS_DAL.Framework
{
    public abstract class ENTBaseData<T> where T : IENTBaseEntity
    {
        public abstract List<T> Select();
 
        public abstract T Select(int id);
 
        public abstract void Delete(CPMSDataContext db, int id);
 
        public void Delete(string connectionString, int id)
        {
            using (CPMSDataContext db = new CPMSDataContext(connectionString))
            {
                Delete(db, id);
            }
        }
    }
}
-----------------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq;
 
namespace CPMS_DAL.Framework
{
    public class tbl_AccountsData : ENTBaseData<cl_Accounts>
    {
        public override List<cl_Accounts> Select()
        {
            using (CPMSDataContext db = new CPMSDataContext())
            {
                return db.sp_Accounts_SelectAll().ToList();  ---------returns error.
            }
        }
 
        public override cl_Accounts Select(int id)
        {
            using (CPMSDataContext db = new CPMSDataContext())
            {
                return db.sp_Accounts_SelectSingle(id).SingleOrDefault(); ----returns error
            }
        }
 
        public override void Delete(CPMSDataContext db, int id)
        {
            db.sp_Accounts_Delete(id);
        }
    }
}

                                  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-08-20 at 10:52:47ID24669009
Tags

C#

Topics

Microsoft Visual C#.Net

,

C# Programming Language

Participating Experts
2
Points
200
Comments
40

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Error: Cannot implicitly convert type 'int' to 'string'
    Error: Cannot implicitly convert type 'int' to 'string' I keep getting this message. How do I take user input from a text box and place it in an integer variable? Also, I know the IsNumeric() test from Visual Basic 6; is there any numeral test like that in C#?
  2. Cannot implicitly convert type 'string' to 'bool'
    Hi experts, how do i rectify this Cannot implicitly convert type 'string' to 'bool' private static bool inCCField (MailItem msg) { bool retval = false; { try { if (msg.CC)>> Cannot implicitly convert type 'string' to 'bool' { ...
  3. Cannot implicitly convert type 'int' to 'bool'
    Cannot implicitly convert type 'int' to 'bool' i am getting the above error in the following lines if (objectID=System.DBNull.Value.ToString()) { }
  4. Cannot implicitly convert type 'void' to 'object'
    See code attached, when i run the code in debug the 'public static void GetNews()' does bring data back but the error (Cannot implicitly convert type 'void' to 'object') is when i try and put the data to a datagrid Any Ideas??
  5. Cannot implicitly convert type 'string' to 'Infragistics.W…
    I am trying to read a record from a database, pluck a field of data from the record, place that data in a variable and then display it in a text box on the screen. I thought it was pretty straight forward but I guess not. I keep getting this error message Cannot implicitly...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: psasikPosted on 2009-08-20 at 13:35:09ID: 25146880

From: http://msdn.microsoft.com/en-us/library/ms379564(VS.80).aspx

Generics and Casting

The C# compiler only lets you implicitly cast generic type parameters to Object, or to constraint-specified types, as shown in Code block 5. Such implicit casting is type safe because any incompatibility is discovered at compile-time.

...

This means that generic collections will not implicitly cast either... Also, this might not be enough code to look at. Where is your tbl_Account type defined?

List<CPMS_DAL.tbl_Account>  != List<CPMS_DAL.cl_Accounts>...

 

by: Samantha1667Posted on 2009-08-20 at 14:08:26ID: 25147157

here is the rest of the code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq;

namespace CPMS_DAL.Framework
{
    public interface IENTBaseEntity
    {
        DateTime CreateDate { get; set; }
        int CreateByID  { get; set; }
        DateTime UpdateDate { get; set; }
        int UpdateByID { get; set; }
        Binary Version { get; set; }
    }
}
--------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CPMS_DAL.Framework;

namespace CPMS_DAL
{
    public partial class cl_Accounts : IENTBaseEntity
    {
        #region IENTBaseEntity Members

        DateTime IENTBaseEntity.CreateDate
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        int IENTBaseEntity.CreateByID
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        DateTime IENTBaseEntity.UpdateDate
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        int IENTBaseEntity.UpdateByID
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        System.Data.Linq.Binary IENTBaseEntity.Version
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        #endregion
    }
}
----------------------------------

 

by: psasikPosted on 2009-08-20 at 14:15:12ID: 25147215

i still need to see the type/class definition of tbl_Account and also the client code where you try to make use of these classes.

 

by: Samantha1667Posted on 2009-08-20 at 14:20:40ID: 25147262

you have everything.  I can't get it to compile.  The tbl_account table has fields defined with exactly the same name and definition in the interface.

 

by: anyoneisPosted on 2009-08-20 at 15:11:25ID: 25147621

Having the same fields does not make one class equal to, or even convertible to, another class.

paraphrasing what psasik said,

typeof(List<CPMS_DAL.tbl_Account>)  != typeof(List<CPMS_DAL.cl_Accounts>)

simply because:

typeof(CPMS_DAL.tbl_Account)  != typeof(CPMS_DAL.cl_Accounts)

David

 

by: Samantha1667Posted on 2009-08-20 at 15:22:25ID: 25147694

Okay, if they are exactly the same name and exactly the same definition, then how do I get them to be equal?  I'm pretty new at this so clarification is really helpful to me.

Thanks.

 

by: anyoneisPosted on 2009-08-20 at 15:41:46ID: 25147787

It's a real quandry that hits everyone as they try to develop well organized and layered software. The upshot is, unless you share a class between the two layers, so that the namespace.classname is identical, you can't do what you are trying to do. Of course, then you are violating the separation between layers you are trying to achieve.

The answer is, "Don't code to implementations (classes), code to abstractions (interfaces)."

Create an interface that contains all of the properties, have the classes in both layers implement that interface, then program against that interface, rather than against the classes. This way, the objects in both layers can evolve independently, as long as they honor the contract (interface) they signed up for.

David

 

by: anyoneisPosted on 2009-08-20 at 15:43:18ID: 25147797

(To your last question: Even having the same name is not enough, since the namespace can be thought of as part of the name.)

dwr

 

by: Samantha1667Posted on 2009-08-21 at 08:54:56ID: 25153106

Okay.  I've defined all properties in the interface IENTBaseEntity, I've implemented them all in cl_Accounts and tbl_AccountData, but I still get the same error.

 

by: anyoneisPosted on 2009-08-21 at 09:01:01ID: 25153190

So, have you change the code to work with the abstraction, IENTBaseEntity, instead of cl_Accounts and tbl_Accounts?

For example,

       public override List<cl_Accounts> Select()
       {
           using (CPMSDataContext db = new CPMSDataContext())
           {
               return db.sp_Accounts_SelectAll().ToList();  ---------returns error.
           }
       }

This will now return a List<IENTBaseEntity>.

David


 

 

by: psasikPosted on 2009-08-21 at 09:02:28ID: 25153206

Did you change you generic Lists' declarations?

List<CPMS_DAL.tbl_Account>    should be:   List<CPMS_DAL.IENTBaseEntity>

and

List<CPMS_DAL.cl_Accounts>   should be:    List<CPMS_DAL.IENTBaseEntity>


 

by: Samantha1667Posted on 2009-08-21 at 09:09:23ID: 25153275

do you mean like this?

namespace CPMS_DAL.Framework
{
    public class tbl_AccountsData : ENTBaseData<IENTBaseEntity>
    {
        public override List<IENTBaseEntity> Select()
        {
            using (CPMSDataContext db = new CPMSDataContext())
            {
                return db.sp_Accounts_SelectAll().ToList();
            }
        }

        public override cl_Accounts Select(int id)
        {
            using (CPMSDataContext db = new CPMSDataContext())
            {
                return db.sp_Accounts_SelectSingle(id).SingleOrDefault();
            }
        }

        public override void Delete(CPMSDataContext db, int id)
        {
            db.sp_Accounts_Delete(id);
        }
    }
}

 

by: anyoneisPosted on 2009-08-21 at 09:54:48ID: 25153625

Yes.

 

by: Samantha1667Posted on 2009-08-21 at 10:02:47ID: 25153695

I'm still getting the same error for this code:
namespace CPMS_DAL.Framework
{
    public class tbl_AccountsData : ENTBaseData<IENTBaseEntity>
    {
        public override List<IENTBaseEntity> Select()
        {
            using (CPMSDataContext db = new CPMSDataContext())
            {
                return db.sp_Accounts_SelectAll().ToList();
            }
        }

        public override IENTBaseEntity Select(int id)
        {
            using (CPMSDataContext db = new CPMSDataContext())
            {
                return db.sp_Accounts_SelectSingle(id).SingleOrDefault();
            }
        }

        public override void Delete(CPMSDataContext db, int id)
        {
            db.sp_Accounts_Delete(id);
        }
    }
}

Its telling me "Cannot implicitly convert type 'System.Collections.Generic.List<CPMS_DAL.tbl_Account>' to 'System.Collections.Generic.List<CPMS_DAL.Framework.IENTBaseEntity>'"

 

by: psasikPosted on 2009-08-21 at 12:05:08ID: 25154812

Sam, i tried to piece together the code you've posted here but came up short. Missing classes... methods etc. Would put all the related classes and interfaces into a single file and post it here? There should just be a single usings' group for example... if i can put this into Snippet Compiler for example, i might be able to help you. Right now, i'm a bit lost. Anyoneis, do you concur?

 

by: Samantha1667Posted on 2009-08-21 at 12:20:37ID: 25154930

I've attached a file that contains all code for the above and table definition to tbl_accounts and the stored procedures it uses.

 

by: psasikPosted on 2009-08-21 at 12:36:29ID: 25155081

It's still missing the definition for the CPMSDataContext class. Can you include that?

 

by: Samantha1667Posted on 2009-08-21 at 12:41:22ID: 25155124

This is created by Visual Studios.

 

by: anyoneisPosted on 2009-08-21 at 14:11:36ID: 25155876

Yes psasik, I agree that we needed to see this other file. The data context class, tbl_Account, is a partial class, so I think you should be able to extend it wihtout touching the auto-generatedI code. I can't try this right now, but perhaps psasik can give you more direction.

Perhaps the cleanest way to do this will be to create a new project for th einterface definitions, and then reference that assembly from your application and from your DAL. Let's say you call the project ENTInterfaces. There will be an interface called ENTInterfaces.IENTBaseEntity. cl_Account should implement this interface.

What I am not sure of is if you can go to the DAL, refernce the ENTInterfaces assembly, and create a file called tbl_Account, which looks something like this

 

     using ENTInterfaces
    public partial class tbl_Accounts : IENTBaseEntity
    {}

This is off the top of my head. I can't play with it right now. Good Luck!!!

 

by: psasikPosted on 2009-08-21 at 14:23:46ID: 25155962

i'm busy as well Sam. And what's worse, i'm still using .Net 2.0 at work. i need to do this at home with SharpDevelop!

But, as another strategy for trying to solve this in the meantime: Create a simpler version of these classes. Such as interfaces with two members instead of a dozen. Give yourself less code to look at, and us. ;-)

Once we get a simple model figured out, applying it to the more complex version will be easy.

 

by: Samantha1667Posted on 2009-08-21 at 14:31:04ID: 25156020

I started out with only 4 members but you guys said I had to define all the fields in my table in the interface now you're telling me it's too many?  How can this be?  The dataContext is auto generated from visual studios so I don't think the problem is there. I believe it's in the interface and how it's being used.  This is based on the example I'm using from WROX "ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008".  Maybe if one of you have access to this book you can see where the code is driving at.

 

by: Samantha1667Posted on 2009-08-21 at 15:36:51ID: 25156478

I don't know how to make this simpler.  I really think you are looking in the wrong direction.  Anyoneis can you take a look as soon as you can?  I'm trying to research on my end as well, maybe there is something small that we are missing.

 

by: anyoneisPosted on 2009-08-21 at 15:54:32ID: 25156586

OK, I found the book at Books 24X7!

Looking at figure 2-6 in the book, he is using the Entity objects (created by the ORM ) in the BLL. That is, DataContext.tbl_Account would be used in your BLL layer. Where did clAccount come from?

He has later on the code below. Notice he is using the equivalent of your tbl_Account object and passing that (or a list of those)back to the BLL . You have introduced another class, cl_Account, but there is no automatic conversion between the two.

David

public class ENTUserAccountData :ENTBaseData<ENTUserAccount>
{
     public override List<ENTUserAccount>Select()
 
{
     using (HRPaidTimeOffDataContext db =new
               HRPaidTimeOffDataContext())
     {
          return db.ENTUserAccountSelectAll().ToList();
     }
}
 
public override ENTUserAccount Select(int id)
     {
          using (HRPaidTimeOffDataContext db =new
                    HRPaidTimeOffDataContext())
          {
               return db.ENTUserAccountSelectById(id).SingleOrDefault();
          }
     }
}
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:

Select allOpen in new window

 

by: anyoneisPosted on 2009-08-21 at 16:03:09ID: 25156617

(Admittedly, there is stuff I don't understand about his solution yet...)

"That's it. Each and every table will have an entity class generated by the ORM Designer, and a Data class to handle communication to the database and the BLL. "

I think this is the Repository pattern, as illustrated in Scottgu's tutorial available at http://tinyurl.com/aspnetmvc.

His <tableName>Data class just passes the ORM entities back and forth between the BLL and the DAL.

(Have I read far enough in the book?)

David

 

by: anyoneisPosted on 2009-08-21 at 16:24:42ID: 25156711

I think the part you are missing is below - adding to the paretial classes created by the ORM designer.


"We want all of our entity classes that are created by the ORM Designer to implement this interface. You could open the file that contains all the entity objects and modify the class declaration to inherit from this interface, but the next time you regenerate a table's class from the ORM Designer you would have to remember to modify the result. This is where partial classes come in handy. You can create another file and then create a partial class that is named the same as the entity class and have that inherit the correct interface. That way, you can regenerate the entity class as often as you want and not have to worry about customizing its code. The goal is to never have to customize the auto-generated code because you will find yourself doing this a lot.
The partial classes all go into one class file called CustomizedEntities in the root folder. Right-click on the DAL project and select Add New Item to add this class to the root folder. You need to add a using statement to reference the V2.PaidTimeOffDAL.Framework namespace and replace the default code with this:"

using V2.PaidTimeOffDAL.Framework;
 
namespace V2.PaidTimeOffDAL
{
      public partial class ENTUserAccount :IENTBaseEntity {}
}
                                              
1:
2:
3:
4:
5:
6:

Select allOpen in new window

 

by: Samantha1667Posted on 2009-08-24 at 08:46:39ID: 25169497

I had this but everyone said I had to implement it in another question I had open here.  I changed it to cl_accounts to differentiate between the table and the class.  If I remove all the get set for each field I will have a build error that says IENTBaseEntity is not implemented.

namespace CPMS_DAL
{
    public partial class cl_Accounts : IENTBaseEntity
}

 

by: anyoneisPosted on 2009-08-24 at 08:52:57ID: 25169559

Unless I am mistaken, the autogenerated class is not cl_accounts, but CPMS_DAL.tbl_Account. tbl_Account is the partial class that you must extend, by marking it as implementing the interface.

 

by: Samantha1667Posted on 2009-08-24 at 09:08:39ID: 25169718

I've changed it to just as you have it above and made sure all the references have the new change:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CPMS_DAL.Framework;

namespace CPMS_DAL
{
    public partial class tbl_Accounts : IENTBaseEntity
    {
    }
}

and now I have my very initial problem, I'm getting errors saying that CPMS_DAL does not implement interface.

 

by: Samantha1667Posted on 2009-08-24 at 09:09:57ID: 25169734

I have in place everything that the example states.

 

by: Samantha1667Posted on 2009-08-24 at 09:11:22ID: 25169757

and I can't get to http://tinyurl.com/aspnetmvc because my job has it blocked.  My boss won't unblock it.  Can you send it to me in a document?

 

by: anyoneisPosted on 2009-08-24 at 09:47:14ID: 25170116

For Guthrie's example, try http://www.wrox.com/WileyCDA/Section/id-321793.html

or http://aspnetmvcbook.s3.amazonaws.com/aspnetmvc-nerdinner_v1.pdf

Back to your problem: What is the exact error?

 

by: Samantha1667Posted on 2009-08-24 at 09:57:37ID: 25170206

originally I started with the same exact code structure as in the book.  the first error I got was about implementation of the interface.  I had another open question for this.  Everyone on that said I had to implement the interface in the clase.  I did so the next error I got was Cannot implicitly convert type 'System.Collections.Generic.List<CPMS_DAL.tbl_Account>' to 'System.Collections.Generic.List<CPMS_DAL.tbl_Accounts>'".  I thought this was confusing so to narrow it down I changed the partial class to cl_Accounts.  that is when I saw the problem.  ---- I want to stop here because I just solved the problem....

My table in sql is tbl_account and the partial class is named tbl_accounts.  the extra 's' was throwing it off.  I changed the partial clase to tbl_account and implemented it and all seems right with the world.  I can't believe this is how it works.  If you could explain to me why it works this way I will give you all the point plus.

 

by: anyoneisPosted on 2009-08-24 at 10:05:15ID: 25170261

I can't explain that! I know that the code generation is supposed to take a plural name in the database, such as tbl_Accounts, and depluralize it for the generated entity. But you seem to be seeing the reverse and that is out of my range of experiences.

But, I'm glad you solved your problem!

I read a little more of the book. The author is puting his "Data classes" in the same assembly as the entity classes generated by the ORM designer. That is one way to go. I thought yours were in a separate assembly, in which case I think the normal route is to create a third assembly, which contains only the interface definitions. This thrid assembly is then referenced by both assemblies, which I was calling the DAL and the BLL.

Cheers!

David.

 

by: Samantha1667Posted on 2009-08-24 at 10:13:29ID: 25170312

Maybe it's not solved?  I'm only getting a successful build.  I am in the linq to sql process or the ORM I'm droping the stored procedures onto the table and maybe that is why the class has to be of the same name?  what I noticed is that of the five members in the interface only 2 need to be implemented in the partial class.  I wonder why?

 

by: Samantha1667Posted on 2009-08-24 at 10:20:48ID: 25170369

any imput from you about this would be amazing...please don't leave the question yet.  I need to understand this.

 

by: anyoneisPosted on 2009-08-24 at 10:34:22ID: 25170475


Hmmm I am having my answers dropped - I responded 5 or 10 minutes ago.  Anyways, I would guess that the other three properties are already part of the autogenerated tbl_Account object?
 

 

by: Samantha1667Posted on 2009-08-24 at 10:40:06ID: 25170521

I found out why it was requiring those 2 properties to be implemented.  It was because they were nullable.  When I made the change in the sql table structure to not nullable then it didn't require implementing.  They were all part of the auto genterate tbl_Account object.  Okay.  Thanks for all your time and help Anyoneis.  I'm going to give you the points anyway because of you time and effort to help me.  Thank you very much.

 

by: anyoneisPosted on 2009-08-24 at 10:43:43ID: 25170553

That's interesting... I'm going to have to look into that one until I understand it.

Ciao,

David

 

by: Samantha1667Posted on 2009-08-24 at 10:45:45ID: 25170573

I was able to solve it.  the minutia of details have to be exact.  starting to hate microsoft.

 

by: Samantha1667Posted on 2009-08-24 at 10:47:07ID: 25170590

Sorry David, I thought that was what I was suppose to put for reason of closing.  Anyway if you do find out why please let me know.  I'm using visual studio 2008 with LINQ to SQL capabilities.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...