none
can't generate database from model RRS feed

  • Question

  • when i try to generate db, i get this error.

    ---------------------------
    Microsoft Visual Studio
    ---------------------------
    Encountered the following errors while processing the template 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\DBGen\SSDLToSQL10.tt:

    Line 0, Column 0: 'Running transformation: System.EntryPointNotFoundException: Entry point was not found.

       at System.Collections.Generic.ICollection`1.get_Count()

       at Microsoft.VisualStudio.TextTemplating45901E98A3A4105C905C0AC791420B4D.GeneratedTextTransformation.InitializeAndValidateExistingStore() in c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\GenerateTSQL.Utility.ttinclude:line 62

       at Microsoft.VisualStudio.TextTemplating45901E98A3A4105C905C0AC791420B4D.GeneratedTextTransformation.TransformText() in c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\DBGen\SSDLToSQL10.tt:line 199

       at Microsoft.VisualStudio.TextTemplating.TransformationRunner.RunTransformation(TemplateProcessingSession session, String source, ITextTemplatingEngineHost host, String& result)'

     

    Sunday, September 25, 2011 9:55 AM

Answers

  • Hello,

    Thank you for posting.

    From your provided error description, it's hard to check what's the root cause of your question. I made a simple demo application on my side (TPC sample).

    namespace ConsoleApplication2
    {
        class Program
        {
            static void Main(string[] args)
            {
                #region TPC
                Database.SetInitializer<InheritanceMappingContext>(new CreateDatabaseIfNotExists<InheritanceMappingContext>());
                using (var ctx = new InheritanceMappingContext("MyString"))
                {
                    BankAccount bankAccount = new BankAccount() { BillingDetailId = 1 };
                    CreditCard creditCard = new CreditCard() { CardType = 1, BillingDetailId = 2 };
                    ctx.BillingDetails.Add(bankAccount);
                    ctx.BillingDetails.Add(creditCard);
                    ctx.SaveChanges();
    
                    var qry = from b in ctx.BillingDetails
                              select b;
                }
                #endregion
                Console.ReadLine();
            }
        }
    
        #region TPC classes
    
        public abstract class BillingDetail
        {
            [DatabaseGenerated(DatabaseGeneratedOption.None)]
            public int BillingDetailId { get; set; }
            public string Owner { get; set; }
            public string Number { get; set; }
        }
    
        [NotMapped]
        public class BankAccount : BillingDetail
        {
            public string BankName { get; set; }
            public string Swift { get; set; }
        }
    
        public class CreditCard : BillingDetail
        {
            public int CardType { get; set; }
            public string ExpiryMonth { get; set; }
            public string ExpiryYear { get; set; }
        }
    
        public class InheritanceMappingContext : DbContext
        {
            public InheritanceMappingContext(string conn)
                : base(conn)
            { }
    
            
            public DbSet<BillingDetail> BillingDetails { get; set; }
    
            protected override void OnModelCreating(DbModelBuilder modelBuilder)
            {
                modelBuilder.Entity<BillingDetail>()
                    .Property(p => p.BillingDetailId)
                    .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
                modelBuilder.Entity<BankAccount>().Map(m =>
                    {
                        m.MapInheritedProperties();
                        m.ToTable("BankAccounts");
                    });
                modelBuilder.Entity<CreditCard>().Map(m =>
                    {
                        m.MapInheritedProperties();
                        m.ToTable("CreditCards");
                    });
            }
        }
    #endregion
    }
    
    

    In addition, I suggest you can provide more detailed code information of your question or you can directly send the demo one to me. v-xugong@microsoft.com

    Thanks,


    Larcolais Gong[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Larcolais Gong Wednesday, October 5, 2011 5:07 AM
    Tuesday, September 27, 2011 4:03 AM

All replies

  • Hello,

    Thank you for posting.

    From your provided error description, it's hard to check what's the root cause of your question. I made a simple demo application on my side (TPC sample).

    namespace ConsoleApplication2
    {
        class Program
        {
            static void Main(string[] args)
            {
                #region TPC
                Database.SetInitializer<InheritanceMappingContext>(new CreateDatabaseIfNotExists<InheritanceMappingContext>());
                using (var ctx = new InheritanceMappingContext("MyString"))
                {
                    BankAccount bankAccount = new BankAccount() { BillingDetailId = 1 };
                    CreditCard creditCard = new CreditCard() { CardType = 1, BillingDetailId = 2 };
                    ctx.BillingDetails.Add(bankAccount);
                    ctx.BillingDetails.Add(creditCard);
                    ctx.SaveChanges();
    
                    var qry = from b in ctx.BillingDetails
                              select b;
                }
                #endregion
                Console.ReadLine();
            }
        }
    
        #region TPC classes
    
        public abstract class BillingDetail
        {
            [DatabaseGenerated(DatabaseGeneratedOption.None)]
            public int BillingDetailId { get; set; }
            public string Owner { get; set; }
            public string Number { get; set; }
        }
    
        [NotMapped]
        public class BankAccount : BillingDetail
        {
            public string BankName { get; set; }
            public string Swift { get; set; }
        }
    
        public class CreditCard : BillingDetail
        {
            public int CardType { get; set; }
            public string ExpiryMonth { get; set; }
            public string ExpiryYear { get; set; }
        }
    
        public class InheritanceMappingContext : DbContext
        {
            public InheritanceMappingContext(string conn)
                : base(conn)
            { }
    
            
            public DbSet<BillingDetail> BillingDetails { get; set; }
    
            protected override void OnModelCreating(DbModelBuilder modelBuilder)
            {
                modelBuilder.Entity<BillingDetail>()
                    .Property(p => p.BillingDetailId)
                    .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
                modelBuilder.Entity<BankAccount>().Map(m =>
                    {
                        m.MapInheritedProperties();
                        m.ToTable("BankAccounts");
                    });
                modelBuilder.Entity<CreditCard>().Map(m =>
                    {
                        m.MapInheritedProperties();
                        m.ToTable("CreditCards");
                    });
            }
        }
    #endregion
    }
    
    

    In addition, I suggest you can provide more detailed code information of your question or you can directly send the demo one to me. v-xugong@microsoft.com

    Thanks,


    Larcolais Gong[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Larcolais Gong Wednesday, October 5, 2011 5:07 AM
    Tuesday, September 27, 2011 4:03 AM
  • I am getting exactly the same error.

    Created a console app, added one item, Model1, in the designer, added one entity with one property (GUID for key).

    Right click, select generate database from model.  The error listed above is reported.

    I installed the June 2011 CTP but had to roll back the designer tools bucause it failed to load the package in VS.

    Any ideas?

     

    Thanks,

    Ted

    --------------------------------------------------------------
    UPDATE: Removing June 2011 CTP fixed the issue.
    Monday, October 3, 2011 3:26 PM
  • We also had this and solved the problem as follows:

    In-edmx file right-click on the blank space between the agencies. Select the 'Properties'.
    -In the properties window edmx, the key 'DDL Generation Template "should be changed to the value' SSDLToOracle.tt '. This was the source of the error!
    (This template defines the conversion oracle. The template can be customized to convert types according to your preference)

    -Change also the key 'Database generation workflow' to 'Generate Oracle via T4 (TPT). Xaml' (not to other error occurs).

    I hope that resolves the error for you too!

    Special thanks for this solution to Paulo Barbosa CTO at QUAY.

    davi

    Tuesday, June 19, 2012 12:44 PM