Enity Framework Code First

I am trying to get the latest provider for EF to work in Code First environment. I got no issue if I build the model through the wizard by pointing it to my DB, but in Code FIrst I cannot connect. Here are my two connection strings:
          <add name="OracleHR"
               connectionString="DATA SOURCE=localhost:1521/XE;PASSWORD=****;PERSIST SECURITY INFO=True;USER ID=HR;"
               providerName="Oracle.DataAccess.Client" />
          <add name="Entities"
               connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=Oracle.DataAccess.Client;provider connection string=&quot;DATA SOURCE=localhost:1521/XE;PASSWORD=****;PERSIST SECURITY INFO=True;USER ID=HR&quot;" providerName="System.Data.EntityClient" />
My second connection string works fine and I can get the data, but first one fails with "Network Error"
Suggestions are appreciated.
Thanks.

user13252411 wrote:
When do you plan to support Code First?We haven't announced a date for that yet. Subscribe to our mail list and keep an eye on our .NET Developer Center for updates.

Similar Messages

  • Entity Framework - Code First - Migration - How to access SQL Server and Oracle using the same context?

    Hello,
    I use Entity Framework code first approach.
    My project is working fine with SQL Server. But, I want to access Oracle too. I want to switch SQL Server and Oracle in run time.
    I am able to access Oracle using "Oracle.ManagedDataAccess.EntityFramework.dl" in a new project.
    But, Is this possible to access SQL Server and Oracle in the same project.
    Thanks,
    Murugan

    This should be possible with a Code-First workflow.  In Code-First the database mapping layer is generated at runtime.
    David
    David http://blogs.msdn.com/b/dbrowne/

  • Entity framework code first inheritance table per type problem

    hello
    i am using ODP.NET version 11.2.0.3.20. i am trying to get entity framework code first to work. one problem i have encountered is with inheritance. i have a "table per type" inheritance scenario. i have 3 tables involved. the base table is called "S_PERIOD" which maps to the base "Period" class. i have a derived table called "S_SEASON_QUARTER" that maps to the derived "Quarter" class. And I have another derived table called "S_SEASON_PRICE_PERIOD" that maps to the derived "PriceBreak" class. for testing purposes i am trying to load all records. the problem is that every class instance ends up being of type "Quarter", which is incorrect. for whatever reason the provider thinks that every "S_PERIOD" record has a corresponding "S_SEASON_QUARTER" record. i took a look at the generated SQL and posted it down below. looking at this SQL it's clear to me why every object ends up being of type "Quarter". It looks like the provider is checking the "C2" field to determine the concrete type to instantiate. the problem however is that the "C2" field value provided by each derived table is ALWAYS equal to "1", which is a problem since this will result in the "case" statement always hitting the second "when" condition. does anyone have any idea how to fix this? thank you
    SELECT
    CASE WHEN (( NOT (("Project1"."C2" = 1) AND ("Project1"."C2" IS NOT NULL))) AND ( NOT (("Project2"."C2" = 1) AND ("Project2"."C2" IS NOT NULL)))) THEN '0X' WHEN (("Project1"."C2" = 1) AND ("Project1"."C2" IS NOT NULL)) THEN '0X0X' ELSE '0X1X' END AS "C1",
    CAST( "Extent1"."PERIOD_ID" AS number(10,0)) AS "C2",
    "Extent1"."START_DATE" AS "START_DATE",
    "Extent1"."END_DATE" AS "END_DATE",
    "Extent1"."NAME" AS "NAME",
    "Extent1"."TYPE_CODE" AS "TYPE_CODE",
    CAST( "Extent1"."CREATE_USER_ID" AS number(10,0)) AS "C3",
    "Extent1"."CREATE_DATE" AS "CREATE_DATE",
    CAST( "Extent1"."MODIFY_USER_ID" AS number(10,0)) AS "C4",
    "Extent1"."MODIFY_DATE" AS "MODIFY_DATE",
    CASE WHEN (( NOT (("Project1"."C2" = 1) AND ("Project1"."C2" IS NOT NULL))) AND ( NOT (("Project2"."C2" = 1) AND ("Project2"."C2" IS NOT NULL)))) THEN NULL WHEN (("Project1"."C2" = 1) AND ("Project1"."C2" IS NOT NULL)) THEN "Project1"."QUARTER_NAME" END AS "C5"
    FROM "DBO_SPACE_DEV"."S_PERIOD" "Extent1"
    LEFT OUTER JOIN (SELECT
         "Extent2"."QUARTER_NAME" AS "QUARTER_NAME",
         CAST( "Extent2"."QUARTER_ID" AS number(10,0)) AS "C1",
         1 AS "C2"
         FROM "DBO_SPACE_DEV"."S_SEASON_QUARTER" "Extent2" ) "Project1" ON ( CAST( "Extent1"."PERIOD_ID" AS number(10,0))) = "Project1"."C1"
    LEFT OUTER JOIN (SELECT
         CAST( "Extent3"."PRICE_PERIOD_ID" AS number(10,0)) AS "C1",
         1 AS "C2"
         FROM "DBO_SPACE_DEV"."S_SEASON_PRICE_PERIOD" "Extent3" ) "Project2" ON ( CAST( "Extent1"."PERIOD_ID" AS number(10,0))) = "Project2"."C1"
    Edited by: 997830 on Apr 3, 2013 8:40 AM

    An update:
    I tried again following this example to the letter:
    Using NuGet to Install and Configure Oracle Data Provider for .NET
    This time I used a console application as described in the example. Yes, I rebuilt the project after the NuGet install.
    I made the appropriate mods to App.config. I get the same error message as with the MVC example above.
    Does the ODP.Net driver really work with EF? If so, can anyone provide me with a working sample project?

  • Boolean types with entity framework code first and oracle provider

    Working in a application that has to work in oracle and sqlServer. In SqlServer we have used "Bit" to store booleans and in oracle number(1).
    Have check other threads in this forum, but didnt find any that fix my problem, sorry if this may have been discused before.
    We have created a code first model were we find few bool properties mapped to database fields.
    for example:
    public partial class ZPruebaBooleano
    public int Numero { get; set; }
    public bool Booleano { get; set; }
    Mapped as:
    this.ToTable("ZPRUEBABOOLEANO", schema);
    this.HasKey<int>(t => t.Numero);
    this.Property(t => t.Numero).HasColumnName("NUMERO");
    this.Property(t => t.Booleano).HasColumnName("BOOLEANO");
    Also, sw added to the application configuration file (for simplicity we have test it without the use of any additional dll):
    <oracle.dataaccess.client>
    <settings>
    <add name="bool" value="edmmapping number(1,0)" />
    <add name="byte" value="edmmapping number(3,0)" />
    <add name="int16" value="edmmapping number(4,0)" />
    <add name="int32" value="edmmapping number(9,0)" />
    <add name="int64" value="edmmapping number(18,0)" />
    </settings>
    </oracle.dataaccess.client>
    I am confident that the provider factory read it when creating the model, because it provokes an exception if i add an invalid entry in any of the type names mapped in the file.
    As i have find in other forums, this should work. But now i am not sure if should work always, including code first.
    I have this exception when i excecute the code (translated from spanish, sorry for any mistake):
    Type 'Edm.Boolean[Nullable=False,DefaultValue=]' from 'Booleano' to type'PruebaBooleanos.ZPruebaBooleano' is not compatyble with 'OracleEFProvider.number[Nullable=False,DefaultValue=,Precision=38,Scale=0]'
    Its funy that says Precision=38. The database is Number(1), i am sure about that, in fact this is the script:
    CREATE TABLE ZPRUEBABOOLEANO
    NUMERO NUMBER(15),
    BOOLEANO NUMBER(1)
    Also, i find it interesting that i was having this mistake even when i was not informing the table i was maping, like if the oracle provider didnt even check if the column was number(anything). Right now is well maped, table and schema.
    I have test to create an integer property wrapped by the boolean one, as we can see in this code.
    namespace PruebaBooleanos
    public partial class ZPruebaBooleano
    public int Numero { get; set; }
    public bool Booleano
    get
    return iBooleano == 1 ? true : false;
    set
    iBooleano = value ? 1 : 0;
    public int iBooleano { get; set; }
    in this last case i ignored the boolean and mapped the integer.
    That worked ok in oracle. But added 2 problems:
    1. It fails in SqlServer, because in sql server is bit
    2. Cant query the entity model using the boolean property as it is not maped to Database.
    I could change the bit field in SqlServer to Number.
    But i would like to keep bit in sqlserver and number(1) in oracle.
    Anyone had a similar problem?
    I am open to any ideas, thanks !!!
    libo

    It's cool. :)
    Sure. I can upload an EDMX file that works against my database if you want to look at it. The relevant parts are probably much like you'd expect. I've removed some columns from this version to make it easier to read.
    From the SSDL:
            <EntityType Name="PARAMETER">
              <Key>
                <PropertyRef Name="PARAMETER_CD" />
              </Key>
              <Property Name="PARAMETER_CD" Type="number" Nullable="false" Precision="4" />
              <Property Name="PARAMETER_ACTIVE_INDR" Type="number" Nullable="false" Precision="1" />
            </EntityType>From the CSDL:
    <EntityType Name="PARAMETER">
              <Key>
                <PropertyRef Name="PARAMETER_CD" />
              </Key>
              <Property Type="Int16" Name="PARAMETER_CD" Nullable="false" />
              <Property Type="Boolean" Name="PARAMETER_ACTIVE_INDR" Nullable="false" />
            </EntityType>From the C-S mapping:
    <EntitySetMapping Name="PARAMETER">
                <EntityTypeMapping TypeName="Model.PARAMETER">
                  <MappingFragment StoreEntitySet="PARAMETER">
                    <ScalarProperty Name="PARAMETER_ACTIVE_INDR" ColumnName="PARAMETER_ACTIVE_INDR" />
                    <ScalarProperty Name="PARAMETER_CD" ColumnName="PARAMETER_CD" />
                  </MappingFragment>
                </EntityTypeMapping>
              </EntitySetMapping>Also worth noting that the EDMX mapper probably won't set the provider and token correctly:
    <Schema Namespace="Model.Store" Alias="Self" Provider="Oracle.DataAccess.Client" ProviderManifestToken="11.2" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">Full version is available at http://www.hiredgoons.ca/DataImport.edmx . This is an early development one so I make no apologies for not renaming columns to something readable. ;) It does work correctly as I've had it in testing (taking data from a 170MB excel file and putting it into Oracle using the model). It was created using DB First.
    When you have it load at runtime, you need the application configuration settings to map bool to number(1). If that's in app.config or web.config it'll pick it up. Probably worth noting that if you don't have the configuration setting and you load this, the model doesn't validate correctly. As soon as you try to create a DbContext from it, you get an immediate exception that number(1) doesn't map to boolean.
    Edited by: Tridus on Nov 21, 2012 3:37 PM

  • Calling Oracle stored procedure with out param of user define type from Entity Framework 5 with code first

    Guys i am using Entity Framework 5 code first (I am not using edmx) with Oracle and all works good, Now i am trying to get data from stored procedure which is under package but stored procedure have out param which is user define type, Now my question is
    how i will call stored procedure from entity framework
    Thanks in advance.

    I agree with you, but issue is we have lots of existing store procedure, which we need to call where damn required. I am sure those will be few but still i need to find out.
    If you think you are going to get existing MS Stored Procedures  or Oracle Packages that had nothing to do with the ORM previously to work that are not geared to do simple CRUD operations with the ORM and the database tables, you have a rude awakening
    coming that's for sure. You had better look into using ADO.NET and Oracle Command objects and call those Oracle Packages by those means and use a datareader.
    You could use the EF backdoor, call Oracle Command object and use the Packages,  if that's even possible, just like you can use MS SQL Server Stored Procedures or in-line T-SQL via the EF backdoor.
    That's about your best shot.
    http://blogs.msdn.com/b/alexj/archive/2009/11/07/tip-41-how-to-execute-t-sql-directly-against-the-database.aspx

  • Call StoreProcedure in Code First Entity FrameWork

    i want to call store procedure by Code First Entity Framework and language:c# . it return one value of string.can i help me?

    hi,
    try this link :
    http://stackoverflow.com/questions/3500509/calling-user-defined-functions-in-entity-framework-4
    this also can help
    http://blogs.msdn.com/b/efdesign/archive/2011/01/21/table-valued-function-support.aspx
    and this:
    http://www.entityframeworktutorial.net/EntityFramework5/table-valued-function-in-entity-framework5.aspx

  • How to create ForeignKey reference to code-first identity tables.

    Hi,
    I'm developing a web application using MVC 5, EntityFramework 6 with a Code-First approach.
    I have successfully created my tables dbo.AspNetRoles, dbo.AspNetUsers... etc, also I have created some custom tables for example a table that must have a relationship between the menus presented and the role of the authenticated user. What I want to add
    to my model is a property like this:
    [ForeignKey]public virtual AspNetRoles Roles { get; set; }
    But of course I have not an AspNetRoles class, because the framework auto generates the tables only in the SQL database, so my question is, I have to manually create this classes? How can I link them to the database tables, I think the issue may be deeper.
    If I can't do this maybe I should go back to SQL manual queries.
    Thanks!

    Hello Morral,
    >> What I want to add to my model is a property like this:
    If you have a separate model to store your own business model, what you have written should be almost ok, however, please take care the [ForeignKey] attribute is usually used to markup a property as an integer property to specify it as a foreign key:
    public virtual int RoleID { get; set; } [ForeignKey("RoleID")] 
    public virtual AspNetRoles Roles { get; set; }
    Or it would generated a combinatorial name.
    >> But of course I have not an AspNetRoles class, because the framework auto generates the tables only in the SQL database, so my question is, I have to manually create this classes?
    From your description, the AspNetRoles class seems to be a system class which is not exposed to user. If so, these classes already exists, you do not need to create them again.
    I notice that you are working with the MVC project, you could also ask this issue to the MVC forum:
    http://forums.asp.net/1146.aspx
    There are MVC experts will help you.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Code first without edmx model : Does metadataworkspace still usefull ?

    Hello community,
    I'm currently trying to migrate from an EDMX object context (generated from the database) to a code first model without any edmx, csdl... file.
    My application is using one database per customer (same database schema for all) so I made something : I've shared the metadataworkspace for all connections to these databases to avoid memory to increase each time a customer connect to its database (because
    it loaded one metadataworkspace objet per database). So my application works very nice with this trick.
    Now that I'm using code first, I would like to know if metadataworkspace is still used because I don't have any csdl file (and the other files that were used to generate metadataworkspace).
    My question is simple : If I remove my little trick into the code first dbcontext, will I be faced to the memory problem that I encountered with old objectcontext ?
    Thanks,
    Regards

    Hello insomniak,
    >>My question is simple : If I remove my little trick into the code first dbcontext, will I be faced to the memory problem that I encountered with old objectcontext?
    As far as I know, code first still uses the metadataworkspace to map types between CLR types and database types, and it actually still has these files, you could check this
    article to get the .edmx file in code first.
    In code first, you could access the metadataworkspace by convert DbContext API to ObjectContext API, for details, you could check this
    blog written by RoMiller who is the Program Manager for the ADO.NET Entity Framework team at Microsoft.
    So for your question, I think the memory would increase along with the connection number of your customers.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to specifiy the provider to be Oracle.ManagedDataAccess.Client when creating a dynamic connection string with EF Code First from Database?

    I am trying to use the relatively new Code First from Database with the newest EF (6.x) and on an Oracle database (11g, but I have installed the newest ODTwithODAC). First of all, it works fine as long as the connection string is inside the App.Config file. But when I try to build it dynamically in the C# code (or rather, statically at the moment) it fails. I have it working with a dynamically built connection string when doing Model from Database though, so I'm at a loss right now.
    First, I have created a second constructor for the context class that takes a string and does base(connectionString). Then I build the connection string via
    OracleConnectionStringBuilder oracleBuilder = new OracleConnectionStringBuilder();
    oracleBuilder.DataSource = "TEST.BLA.COM";
    oracleBuilder.UserID = "ABC";
    oracleBuilder.Password = "abc";
    oracleBuilder.PersistSecurityInfo = true;
    string connection = oracleBuilder.ToStrin();
    Now trying to open an EntityConnection by giving to it this provider-specific connection string (or even the static one from the App.Config) doesn't work; I get "keyword not supported: user id"). Trying it by creating a context and giving this connection string doesn't work either. I'm pretty sure that this is because I didn't specify the provider to use; after all, it should use the Oracle.ManagedDataAccess.Client provider and not an SQL Server based one.
    I then tried to get around this by using an EntityConnectionStringBuilder on top and specifying the provider keyword there, but then I get "keyword not supported: provider" when using it in the context constructor, and "the 'metadata' keyword is always required" when using it with the EntityConnection constructor.
    As I said above: I bet it's the provider that I have to specify somehow, but I don't know how. The code that does work is the following:
    using (var context = new Model())
    context.Database.Connection.Open();
    context.Database.Connection.Close();
    When I read context.Database.Connection.ConnectionString, it is exactly the provider-specific connection string I created above, but I don't know where to specify the provider again. Do you know of any way to do this? Certainly there must be one.
    PS: I have also posted this question on http://stackoverflow.com/questions/27979454/ef-code-first-from-database-with-managed-oracle-data-access-dynamic-connection because it is quite urgent and I'd like to use Code First from Database. Otherwise I'd have to go "back" to using Model from Database again, which is not ideal because we have updatable views where the .edmx-file has to be edited after every reload of the model, while with Code First from DB inserting into the view automatically works.

    I am trying to use the relatively new Code First from Database with the newest EF (6.x) and on an Oracle database (11g, but I have installed the newest ODTwithODAC). First of all, it works fine as long as the connection string is inside the App.Config file. But when I try to build it dynamically in the C# code (or rather, statically at the moment) it fails. I have it working with a dynamically built connection string when doing Model from Database though, so I'm at a loss right now.
    First, I have created a second constructor for the context class that takes a string and does base(connectionString). Then I build the connection string via
    OracleConnectionStringBuilder oracleBuilder = new OracleConnectionStringBuilder();
    oracleBuilder.DataSource = "TEST.BLA.COM";
    oracleBuilder.UserID = "ABC";
    oracleBuilder.Password = "abc";
    oracleBuilder.PersistSecurityInfo = true;
    string connection = oracleBuilder.ToStrin();
    Now trying to open an EntityConnection by giving to it this provider-specific connection string (or even the static one from the App.Config) doesn't work; I get "keyword not supported: user id"). Trying it by creating a context and giving this connection string doesn't work either. I'm pretty sure that this is because I didn't specify the provider to use; after all, it should use the Oracle.ManagedDataAccess.Client provider and not an SQL Server based one.
    I then tried to get around this by using an EntityConnectionStringBuilder on top and specifying the provider keyword there, but then I get "keyword not supported: provider" when using it in the context constructor, and "the 'metadata' keyword is always required" when using it with the EntityConnection constructor.
    As I said above: I bet it's the provider that I have to specify somehow, but I don't know how. The code that does work is the following:
    using (var context = new Model())
    context.Database.Connection.Open();
    context.Database.Connection.Close();
    When I read context.Database.Connection.ConnectionString, it is exactly the provider-specific connection string I created above, but I don't know where to specify the provider again. Do you know of any way to do this? Certainly there must be one.
    PS: I have also posted this question on http://stackoverflow.com/questions/27979454/ef-code-first-from-database-with-managed-oracle-data-access-dynamic-connection because it is quite urgent and I'd like to use Code First from Database. Otherwise I'd have to go "back" to using Model from Database again, which is not ideal because we have updatable views where the .edmx-file has to be edited after every reload of the model, while with Code First from DB inserting into the view automatically works.

  • How to Configure SQLServer2008R2 to let Windows Authenticated Users Create Database with MCV4 Code First App

    Trying to Learn MVC code first with Vs2013 web express on windows 7 os computer. When code runs to create database get: An exception of type 'System.Data.SqlClient.SqlException' occurred in EntityFramework.dll but was not handled in user code
    Additional information: CREATE DATABASE permission denied in database 'master'.
    Have this problem with the 'OdeToFood' plurasight course as well with the
    'developing ASP.NET MvC 4 Web Applications Jump Start' MVA course.
    Re-installed sql2008r2 using window
    admin user and ran the project and get same message as when i run the project with the none admin user. 
    What are steps to allow database creation for admin user and none windows admin user?
    Daniel Howard

    David, thanks for the reply.
    I believe the problem may be something else because after adding the 
    user to 'sysadmin' and I still get the message
    Additional information: CREATE DATABASE permission denied in database 'master'.
    Perhaps I need to go to ASP.NET forum to ask the question.
    I will mark you answer as answer.
    Thanks again
    Daniel
    Daniel Howard

  • What King of exception handling is done in OA framework code?

    Hi All,
    I am not a core java person but have to do some OA framework code changes.Wanted to know what kind of exception handling is done in OAF codes?
    I was looking as the seeded oracle controllers and dont see any try catch blocks.
    can anyone guide me?

    OAF java based framework, hence exception handling is similar to how its done in core java. I would advuce to better go through exception handling concepts of core java.
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                   

  • EF6 Code first inheritance from relationship

    I need to create a TPH inheritance on an existing database using EF6 and Code first
    Table Person
    PersonId (Key)
    PersonName
    PersonTypeId (FK)
    Table PersonType:
    PersonTypeId (Key)
    Description
    Category
    The field PersonTypeId is the discriminator for the employees and managers, and the classes that I use are:
    class Person
    public string PersonId {get; set;}
    public string  TypeId {get; set;}
    public PersonType Type {get; set}
    class Employee : Person
    class Manager : Person
    I use the fluent API to create the relationship between Person and
    PersonType like that:
    HasOptional(e => e.Type).WithMany().HasForeignKey(f => f.TypeId);
    and it works as expected.
    Now, I need to Map the inherintance like that:
     m.Requires("Type.Category").HasValue("EMP");
    but it doesn't work because I receive an exception saying that the discriminator field doesn't exist.
    Any suggestions??

    I try to explain me better
    m.Requires("PersonTypeId").HasValue("EMP")
    It's ok, but it's not what I need 
    The mapping discriminator is not the PersonTypeId but the Category field that is in the class(or table) referred by PersonTypeId
    I have more than one values of PersonTypeId that has the same category (employee).
    If I choose your solution I need that PersonTypeId has more than one value
    Like that:
    m.Requires("PersonTypeId").HasValue("1").HasValue("2");
    but I know that there isn't this possiblity to have more than 1 value for a discriminator. Is it true?
    I try to explain me better
    m.Requires("PersonTypeId").HasValue("EMP")
    It's ok, but it's not what I need 
    The mapping discriminator is not the PersonTypeId but the Category field that is in the class(or table) referred by PersonTypeId
    I have more than one values of PersonTypeId that has the same category (employee).
    If I choose your solution I need that PersonTypeId has more than one value
    Like that:
    m.Requires("PersonTypeId").HasValue("1").HasValue("2");
    but I know that there isn't this possiblity to have more than 1 value for a discriminator. Is it true?

  • Hi my phone is disabled and asking me to conect to itunes but when i conect to itunes it says can not conect as u have to type code first on ipone ....help pls

    hi my phone is disabled and asking me to conect to itunes but when i conect to itunes it says can not conect as u have to type code first on ipone ....help pls

    If the phone is actually working you can reset it fron the handset, but yours does not appear to be working. Be sure you are using a good cable and the cable is connected directly to a USB port on the computer (not a hub). Follow the instructions carefully in that link; the computer will not recognize the phone until it is in Recovery mode, and it's complicated to get it there. If you have followed the instructions exactly and it still is not recognized in iTunes. try removing and reinstalling iTunes: http://support.apple.com/kb/HT1925. If that still fails try a different computer, and also try restoring from DFU mode (Google is your friend).

  • [svn:osmf:] 13855: Modify plugin framework code to automatically pass MediaFactory to PluginInfo .initializePlugin via the existing metadata namespace.

    Revision: 13855
    Revision: 13855
    Author:   [email protected]
    Date:     2010-01-28 09:44:32 -0800 (Thu, 28 Jan 2010)
    Log Message:
    Modify plugin framework code to automatically pass MediaFactory to PluginInfo.initializePlugin via the existing metadata namespace.  Update unit tests.
    Modified Paths:
        osmf/branches/sprint9-candidate/framework/OSMF/org/osmf/plugin/PluginLoader.as
        osmf/branches/sprint9-candidate/framework/OSMFTest/org/osmf/plugin/TestPluginManager.as

    Revision: 13855
    Revision: 13855
    Author:   [email protected]
    Date:     2010-01-28 09:44:32 -0800 (Thu, 28 Jan 2010)
    Log Message:
    Modify plugin framework code to automatically pass MediaFactory to PluginInfo.initializePlugin via the existing metadata namespace.  Update unit tests.
    Modified Paths:
        osmf/branches/sprint9-candidate/framework/OSMF/org/osmf/plugin/PluginLoader.as
        osmf/branches/sprint9-candidate/framework/OSMFTest/org/osmf/plugin/TestPluginManager.as

  • EF Code First: FLOAT Columns generate [Column(TypeName = "float")], which give errors

    When I create a simple table with a FLOAT(126) column and add an ADO.NET Entity Data Model with Code first from the database I get a decimal for the FLOAT column with the following ColumnAttribute: [Column(TypeName = "float")].
    When I try to add a controller for this generated Code First class, it fails with the following message:
    Error:
    There was an error running the selected code generator:
    'Unable to retrieve metadata for 'MyNamespace.TEMP_WITHFLOAT'.
    Schema specified is not valid. Errors:
    (8,12) : error 2019: Member Mapping specified is not valid. The type 'Edm.Decimal[Nullable=False,DefaultValie=,Precision=38,Scale=0]' of member 'FLOATCOL' in type 'MyNamespace.TEMP_WITHFLOAT' is not compatible with 'SqlServer.float[Nullable=False,DefaultValue=]' of member 'FLOATCOL' in type 'MySchema.TEMP_WITHFLOAT'.'
    It fails with the same error if I specify other values for precision and scale (or remove the lines entirely) in the code invoking HasPrecision in the generated model.
    The error message when trying to add a controller for the generated class:
    But - if I remove the attribute [Column(TypeName = "float")] from the generated Code First class, the controller is created without errors, and works as it should, returning decimal numbers correctly (it happily ignores that the scale is set to 0 in the generated model).
    The generated class with the ColumnAttribute removed:
        [Table("MYDBSCHEMA.TEMP_WITHFLOAT")]
        public partial class TEMP_WITHFLOAT
            [DatabaseGenerated(DatabaseGeneratedOption.None)]
            public int ID { get; set; }
            //[Column(TypeName = "float")]
            public decimal FLOATCOL { get; set; }
    Correct JSON output from working controller:
    [ { "ID": 1, "FLOATCOL": 123.0 }, { "ID": 2, "FLOATCOL": 123.456789012345 } ]
    It would be very nice if the Code First generated classes worked out of the box, without a required step to manually remove the Column attribute for every FLOAT column.
    Is there a workaround or other solution to this problem? The best solution would be if the generated code is mapped correctly between compatible database and C# types.
    Simple code to reproduce the issue:
    SQL script for the table:
    CREATE TABLE "TEMP_WITHFLOAT"
       ( "ID" NUMBER(10,0) NOT NULL ENABLE,
      "FLOATCOL" FLOAT(126) NOT NULL ENABLE
       ) PCTFREE 10 INITRANS 1 NOCOMPRESS LOGGING;
    ALTER TABLE "TEMP_WITHFLOAT" ADD CONSTRAINT "PK_TEMP_WITHFLOAT" PRIMARY KEY ("ID") ENABLE;
    The generated class:
       [Table("MYDBSCHEMA.TEMP_WITHFLOAT")]
        public partial class TEMP_WITHFLOAT
            [DatabaseGenerated(DatabaseGeneratedOption.None)]
            public int ID { get; set; }
            [Column(TypeName = "float")]
            public decimal FLOATCOL { get; set; }
    The generated model:
        public partial class TempWithFloatModel : DbContext
            public TempWithFloatModel()
                : base("name=TempWithFloatModel")
            public virtual DbSet<TEMP_WITHFLOAT> TEMP_WITHFLOAT { get; set; }
            protected override void OnModelCreating(DbModelBuilder modelBuilder)
                modelBuilder.Entity<TEMP_WITHFLOAT>()
                    .Property(e => e.FLOATCOL)
                    .HasPrecision(38, 0);

    The annotation is emitted by the entity designer because it is necessary to preserve type fidelity with the source database column.
    If the annotation is removed, the FLOATCOL property in the generated class would map to an Oracle number(38) column. But, of course, that is not what the source column is in this case.
    For example, this would be a problem if a database initializer was subsequently used to re-create the database or if a script was generated via migrations using the class without the annotation.
    It's interesting that the error message refers to SqlServer.float type.
    I'll try to investigate a bit more...

Maybe you are looking for

  • 21.3" Samsung LCD Monitor with my 15" Macbook PRo

    Hi.. I have a 15" Macbook pro and I recently hooked iit up to a 1600 x 1200 resolution samsung monitor. I would like to use mirror display but it looks terrible because they both use the same resolutions. Is it possible to use the mirror display mode

  • Where is the proof of Exadata load rates of 5Tb/hour

    I ask this because we cant come close to this.. Is it just a theoretical exercise? Or something that is very restricted? ie. if you load 5Tb of data consisting of 1 column of 10 characters, you can complete this in 1 hour? Whats the real world expect

  • JInitiator - 2 versions for two different systems

    I had a requirement of having two differnt versions of Jinitiator loaded on a single client system. This is requiremnt for two different applications say application 'a' and application 'b'; Will browser recognise which one to choose depending upon a

  • How can I save a video's position using the FLVPlayback component

    I've got a video I'd like people to be able to navigate away from in my project, but resume where it left off if they come back to it.  I would think I could do this by just saving its current position when they exit that frame as a variable and then

  • Core DLL failed to load

    Suddenly I get the message "CORE DLL" failed to load whenever I try to read an Adobe file. I've removed the program 3 times and downloaded a new download from the Adobe website, but still I get the same result:"CORE DLL" failed to load. Any suggestio