Click here to Skip to main content
15,913,854 members
Home / Discussions / C#
   

C#

 
GeneralRe: Installation of windows application on a specified drive using in c# Pin
Pete O'Hanlon26-Jun-14 1:33
mvePete O'Hanlon26-Jun-14 1:33 
GeneralRe: Installation of windows application on a specified drive using in c# Pin
pavnesh26-Jun-14 1:37
pavnesh26-Jun-14 1:37 
AnswerRe: Installation of windows application on a specified drive using in c# Pin
Keith Barrow26-Jun-14 1:10
professionalKeith Barrow26-Jun-14 1:10 
GeneralRe: Installation of windows application on a specified drive using in c# Pin
pavnesh26-Jun-14 1:26
pavnesh26-Jun-14 1:26 
GeneralRe: Installation of windows application on a specified drive using in c# Pin
Keith Barrow26-Jun-14 1:59
professionalKeith Barrow26-Jun-14 1:59 
AnswerRe: Installation of windows application on a specified drive using in c# Pin
Bernhard Hiller26-Jun-14 2:40
Bernhard Hiller26-Jun-14 2:40 
QuestionC# Class Library to Portable Class Library Pin
BaSs_HaXoR25-Jun-14 21:11
BaSs_HaXoR25-Jun-14 21:11 
AnswerRe: C# Class Library to Portable Class Library Pin
Pete O'Hanlon25-Jun-14 22:51
mvePete O'Hanlon25-Jun-14 22:51 
GeneralRe: C# Class Library to Portable Class Library Pin
BaSs_HaXoR26-Jun-14 2:32
BaSs_HaXoR26-Jun-14 2:32 
GeneralRe: C# Class Library to Portable Class Library Pin
Pete O'Hanlon26-Jun-14 5:17
mvePete O'Hanlon26-Jun-14 5:17 
AnswerRe: C# Class Library to Portable Class Library Pin
BaSs_HaXoR26-Jun-14 11:50
BaSs_HaXoR26-Jun-14 11:50 
QuestionI have a PDF Documnet that would like to extract Content from PDF and Chackbox and Radio Button types fields value. PDF file have a version 1.4(Acrobat 5.x) and may be genrated from web browser Pin
Anbuselvan_8325-Jun-14 19:49
Anbuselvan_8325-Jun-14 19:49 
QuestionC sharp windows application development Pin
Galacha Kevin25-Jun-14 1:54
Galacha Kevin25-Jun-14 1:54 
AnswerRe: C sharp windows application development Pin
OriginalGriff25-Jun-14 2:52
mveOriginalGriff25-Jun-14 2:52 
AnswerRe: C sharp windows application development Pin
Dave Kreskowiak25-Jun-14 3:16
mveDave Kreskowiak25-Jun-14 3:16 
GeneralRe: C sharp windows application development Pin
OriginalGriff25-Jun-14 3:18
mveOriginalGriff25-Jun-14 3:18 
AnswerRe: C sharp windows application development Pin
Gerry Schmitz25-Jun-14 9:51
mveGerry Schmitz25-Jun-14 9:51 
QuestionUnable to cast object of type 'System.Collections.Generic.List`1[CustomerManager.Model.Customer]' to type 'CustomerManager.Model.Customer'. Pin
uglyeyes25-Jun-14 0:25
uglyeyes25-Jun-14 0:25 
AnswerRe: Unable to cast object of type 'System.Collections.Generic.List`1[CustomerManager.Model.Customer]' to type 'CustomerManager.Model.Customer'. Pin
Dave Kreskowiak25-Jun-14 3:14
mveDave Kreskowiak25-Jun-14 3:14 
GeneralRe: Unable to cast object of type 'System.Collections.Generic.List`1[CustomerManager.Model.Customer]' to type 'CustomerManager.Model.Customer'. Pin
uglyeyes25-Jun-14 3:20
uglyeyes25-Jun-14 3:20 
GeneralRe: Unable to cast object of type 'System.Collections.Generic.List`1[CustomerManager.Model.Customer]' to type 'CustomerManager.Model.Customer'. Pin
Dave Kreskowiak25-Jun-14 3:22
mveDave Kreskowiak25-Jun-14 3:22 
GeneralRe: Unable to cast object of type 'System.Collections.Generic.List`1[CustomerManager.Model.Customer]' to type 'CustomerManager.Model.Customer'. Pin
uglyeyes25-Jun-14 3:39
uglyeyes25-Jun-14 3:39 
GeneralRe: Unable to cast object of type 'System.Collections.Generic.List`1[CustomerManager.Model.Customer]' to type 'CustomerManager.Model.Customer'. Pin
Dave Kreskowiak25-Jun-14 3:51
mveDave Kreskowiak25-Jun-14 3:51 
GeneralRe: Unable to cast object of type 'System.Collections.Generic.List`1[CustomerManager.Model.Customer]' to type 'CustomerManager.Model.Customer'. Pin
uglyeyes25-Jun-14 3:57
uglyeyes25-Jun-14 3:57 
Ok. I did as per you mentioned but I get below error now
C#
using (var dbCtx = new CustomerManagerContext())
            {
                dbCtx.Customers.Add(customer1);
                dbCtx.SaveChanges();
                 dbCtx.Customers.Add(customer2);
                dbCtx.SaveChanges();
                dbCtx.Companies.Add(company1);
                //call SaveChanges
                dbCtx.SaveChanges();
               
                 dbCtx.Orders.Add(order1);
                 dbCtx.SaveChanges();
                dbCtx.Orders.Add(order2);
                 dbCtx.SaveChanges();
                
            }


Entities in 'CustomerManagerContext.Customers' participate in the 'Customer_Companies' relationship. 0 related 'Customer_Companies_Target' were found. 1 'Customer_Companies_Target' is expected.

this is because I have below method
C#
protected override void OnModelCreating(DbModelBuilder modelBuilder)
       {

           modelBuilder.Entity<Customer>().
           HasMany(c => c.Companies).
           WithMany(p => p.Customers).
           Map(
           m =>
           {
               m.MapLeftKey("CustomerId");
               m.MapRightKey("CompanyId");
               m.ToTable("CustomerCompany");
           });
           modelBuilder.Entity<Company>().HasRequired(c => c.Customers).WithMany().WillCascadeOnDelete(false);
           modelBuilder.Entity<Customer>().HasRequired(c => c.Companies).WithMany().WillCascadeOnDelete(false);
           base.OnModelCreating(modelBuilder);
       }


sorry still learning entity framework.
GeneralRe: Unable to cast object of type 'System.Collections.Generic.List`1[CustomerManager.Model.Customer]' to type 'CustomerManager.Model.Customer'. Pin
Nathan Minier25-Jun-14 4:07
professionalNathan Minier25-Jun-14 4:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.