Seeding multiple databases with single Entity Framework context

I am developing a single-instance, multi-tenant web application, with a SQL database using Entity Framework 6 Code-First. 
I want to have a separate database for each client, generated from the same EF models, with a single DbContext. The database to connect to will be determined by the subdomain that the client is using the web app from. 
This seems to work fine and the correct database is connected to depending on the subdomain. However my issue is seeding the databases with data. This is the code I have:
foreach (var connString in ConfigurationManager.ConnectionStrings.Cast<ConnectionStringSettings>()))
Configuration.PerformDatabaseMigration(connString.Name);
This then calls the PerformDatabaseMigration method: 
public class Configuration : DbMigrationsConfiguration<DataContext>
public Configuration()
AutomaticMigrationsEnabled = false;
AutomaticMigrationDataLossAllowed = false;
public static void PerformDatabaseMigration(string connStringName)
var databaseInitialiser = new Configuration { TargetDatabase = new DbConnectionInfo(connStringName) };
var dbMigrator = new DbMigrator(databaseInitialiser);
dbMigrator.Update();
protected override void Seed(DataContext context)
base.Seed(context);
var superAdmin = new User { Id = 1, UserName = "SuperAdmin" };
context.Users.AddOrUpdate(superAdmin);
The issue is that when seeding this data for the second database, the context passed into the Seed method already has the admin user added to the `DbSet<User>` property of the context, even though the context is for the second databse connection, not
the first. It appears that the context is not being cleared from seeding the first database, and so I receive a `DbUpdateException`, as my User.Username field is a unique index.
Cannot insert duplicate key row in object 'dbo.Users' with unique index 'IX_UserName'. The duplicate key value is (SuperAdmin).\r\nThe statement has been terminated.
public class User : ModelBase, IUserIdentity, IPrincipal, IIdentity 
    [Index(IsUnique = true)]     
  [Required]     
  [StringLength(40)]       
public string UserName { get; set; }

Hello Attune,
>>This seems to work fine and the correct database is connected to depending on the subdomain. However my issue is seeding the databases with data.
Is that you firstly create these databases and then call the PerformDatabaseMigration method to seed these database with data? Do you have a try to seed these database data when creating the database with AutomaticMigrationsEnabled = true; with your provided
configuration class, I tested it and it could work as seeding same data to different database:
internal sealed class Configuration : DbMigrationsConfiguration<CFs.CFContext>
public Configuration()
AutomaticMigrationsEnabled = true;
public static void PerformDatabaseMigration(string connStringName)
var databaseInitialiser = new Configuration { TargetDatabase = new DbConnectionInfo(connStringName) };
var dbMigrator = new DbMigrator(databaseInitialiser);
dbMigrator.Update();
protected override void Seed(CFs.CFContext context)
base.Seed(context);
var superAdmin = new ApplicationUser() { ApplicationUserID = 1, FirstName = "", LastName = "" };
context.ApplicationUsers.AddOrUpdate(superAdmin);
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.

Similar Messages

  • Multiple database users, ORM, entity framework, best practices

    Hello everyone!
    You've already helped me several times, however I must ask for an advice once more.
    I was assigned to develop .NET application with Data Access Layer and I've decided to use Oracle Database Software to provide sample data.
    As I'm absolute novice considering creating DAL I'd be grateful if you can examine my plan in terms of security and reliability:
    My database:
    1) I've created database with sample tables and relations between them. All tables belongs to databaseAdmin.
    2) I've created HR and Manager database users and granted them some privileges on certain databaseAdmin's tables. My intention is to reduce access to unnecessary tables. If my application user want to make some changes to Customers table it should be enough to connect to database as HR.
    And now I'd like to map my database using Entity Framework in my application. And that's where I have a problem:
    -If I create Entity Model basing on databaseAdmin tables I get perfect model, however every Entity SQL query would be executed on behalf of databaseAdmin, which breaks my idea of hiding unnecessary tables.
    -If I create Entity Model for HR and Manager users, my models could overlap on tables that both users have access to and no connection between tables would be generated (as from their point of view those tables are just some tables that belong to databaseAdmin)
    Could you help me with this deadlock? Or maybe my assumptions about multiple database users are incorrect? Please, bear in mind I'm a novice.
    I was trying to find a solution in web, and there're tons of data discussing technical aspects of Entity Framework etc., but not so many documents about conceptual model of database.

    hi Michael,
    Thanks for you posting!
    Sorry for I am not totally understanding your issue. Maybe two points need your confirm:
    1. I confuse with the "Service controller"? IS your meaning MVC controller? Or ServiceController(http://www.codeproject.com/Articles/31688/Using-the-ServiceController-in-C-to-stop-and-start
    2.whether  The type of ID in the model is match to the database ? In other words, Is the type of IDin .edmx matched to the database?
    By the way, it seems that this issue is more related to EF. You could post this issue on EF discussion for better support.
    Thanks & Regards,
    Will
    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.

  • Multiple database in single server

    Hi experts,
    Please tell me how to configure multiple SID with single listener.
    I configured the DR setup of two databases in single server. Now the problem is, if I start one listener from orapm1(CRM), my data is replicating only for CRM, and if I am going to start my listener from oraPE2 user (DBM), error is coming u201C listener is already startu201D but DBM is not replicating with DR site.
    And when I stop the listener from oraPM1, and start listener from user oraPE2(DBM), my DBM is replicating properly, I want to start both in parallel with one listener.
    Right now I have only one port for both database (1527) and only one LISTENER, should I need to change the port for one server e.g DBM (primary and standby), and then change in listener files. For both side (primary and standby)
    If I am correct please let me know the steps, what precautions we need to take.
    And what change I need to do in listener file.
    2nd) Can I work on same port for both SIDs, if yes please tell me the steps.
    My CRM is working properly so I need to change in DBM part.
    I am attaching listener file from both users in same server (10.11.230.12)
    ADMIN_RESTRICTIONS_LISTENER = on
    LISTENER_PE2 =
    (ADDRESS_LIST =
    (ADDRESS =
    (PROTOCOL = IPC)
    (KEY = PE2.WORLD)
    (ADDRESS=
    (PROTOCOL = IPC)
    (KEY = PE2)
    (ADDRESS =
    (COMMUNITY = SAP.WORLD)
    (PROTOCOL = TCP)
    (HOST = 10.11.230.12)
    (PORT = 1527)
    STARTUP_WAIT_TIME_LISTENER = 0
    CONNECT_TIMEOUT_LISTENER = 10
    TRACE_LEVEL_LISTENER = OFF
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PE2)
    (ORACLE_HOME = /oracle/PE2/102_64)
    pm1 listener file
    ADMIN_RESTRICTIONS_LISTENER = on
    LISTENER =
    (ADDRESS_LIST =
    (ADDRESS =
    (PROTOCOL = IPC)
    (KEY = PM1.WORLD)
    (ADDRESS=
    (PROTOCOL = IPC)
    (KEY = PM1)
    (ADDRESS =
    (COMMUNITY = SAP.WORLD)
    (PROTOCOL = TCP)
    (HOST = 10.11.230.12)
    (PORT = 1527)
    STARTUP_WAIT_TIME_LISTENER = 0
    CONNECT_TIMEOUT_LISTENER = 10
    TRACE_LEVEL_LISTENER = OFF
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PM1)
    (ORACLE_HOME = /oracle/PM1/102_64)
    Thanks in advance.

    Dear Experts,
    please tell me is it ok or i need to change something else?
    this example is for only one listener, and i put both SID details in same LISTENER, or i need to change the listener name for another server. it is very confusing...
    ADMIN_RESTRICTIONS_LISTENER = on
    LISTENER =
      (ADDRESS_LIST =
            (ADDRESS =
              (PROTOCOL = IPC)
              (KEY = PM1.WORLD)
            (ADDRESS=
              (PROTOCOL = IPC)
              (KEY = PM1)
            (ADDRESS =
              (COMMUNITY = SAP.WORLD)
              (PROTOCOL = TCP)
              (HOST = 10.11.230.12)
              (PORT = 1527))
    LISTENER =
      (ADDRESS_LIST =
            (ADDRESS =
              (PROTOCOL = IPC)
              (KEY =PE2.WORLD)
            (ADDRESS=
              (PROTOCOL = IPC)
              (KEY = PE2)
            (ADDRESS =
              (COMMUNITY = SAP.WORLD)
              (PROTOCOL = TCP)
              (HOST = 10.11.230.12)
              (PORT = 1528))
    SID_LIST_LISTENER =
      (SID_LIST =
        (SID_DESC =
          (SID_NAME = PM1)
          (ORACLE_HOME = /oracle/PM1/102_64)
    STARTUP_WAIT_TIME_LISTENER = 0
    CONNECT_TIMEOUT_LISTENER = 10
    TRACE_LEVEL_LISTENER = ON
    SID_LIST_LISTENER  =
      (SID_LIST =
        (SID_DESC =
          (SID_NAME = PE2)
          (ORACLE_HOME = /oracle/PE2/102_64)
    Rishi

  • Update the database structure from entity Framework Model

    Hello !
    I'm using VB.net , EF6 with SQL server 2008R2 database.
    This is the situation :
    I have created the application. Using wizard I have created the Entity model from an existing database.
    A client start using this application using this database on his computer.
    After some month , I made some modifications on the database and I have updated the model on my application .
    Now I have a new .exe file that has the new model from the new database.
    I put the new .exe file on the client computer.
    Now on his computer : The .exe file has the new database model , but the sql server database has the old structure.
    I want to know : Is possible to update the database structure from the entity model on application ?
    I want to add a command on application that can make ( if is possible ) this update , so the database become up to date according to entity model ?
    Thank you !

    Hello,
    From your description, it seems that you want to apply a migration for a database first approach, unfortunately, as far as I know, EF Migrations is a product targeted at Code First and doesn't support Database First operations. A workaround I know is to
    use update-scripts. If your database structure would be changed frequently, it is recommended to use the Code First approach which would have a better workaround for migrations, for details, you could refer to this
    video,
     and with the
    Entity Framework Power Tools, it is easy to create a code first based project form an existing database.
    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.

  • Is it possible to integrate multiple instances with single OAM (Oracle Acce

    Hi All,
    Please could anyone clarify,is it possible to integrate multiple instance with single OAM(Oracle Access Manager).
    We have two instance in development environment, Among them one is already integrated with OAM 11g,Now we want to integrate the second one with OAM 11g. For this already configured OAM is enough or we need to configure the another OAM separately.
    Application Version is 12.1.1
    Database Version : 11.1.0.7
    OS : RHEL 5.3 64 bit
    Thanks in advance.

    Hi Hussein ,
    I Ran below script,
    ant -f txkEBSAuth.xml \
    -Dwlshosturl=appora.corp.hexaware.com:7021 \
    -Dwlsuser=weblogic \
    -Dwlspwd=password1 \
    -DuseDefaults=true \
    -DforceDataSource=true \
    -DdataSourceName=DEV \
    -DdataSourceJNDIName=jndi/DEV \
    -DasadminUser=SSO11GLOGIN \
    -DasadminPassword=welcome1 \
    -DdbcFile=/u06/oamfmw/Middleware/appsutil/accessgate/DEV/DEV.dbc \
    -DserverName=AdminServer \
    -DdeploymentName=ebsauth_DEV \
    -DfndauthWarFile=/u06/oamfmw/Middleware/appsutil/accessgate/DEV/fndauth.war \
    -DplanPath=/u06/oamfmw/Middleware/appsutil/accessgate/DEV/plan/plan.xml \
    -DforceDeployment=true \
    -DSSOServerRelease=11 \
    -DSSOServerURL=http://appora.corp.hexaware.com:14100 \
    -DWebgateLogoutURL=http://appora.corp.hexaware.com:7780/public/oacleanup.html \
    -DlogConfigfile=/u06/oamfmw/Middleware/appsutil/accessgate/DEV/sample/logging.properties
    -bash: ant: command not found
    Thanks in advance

  • Can we create multiple application with single MSI(or Same MSI) in biztalk admin console ?

    Can we create multiple application with single MSI(or Same MSI) in biztalk admin console ?
    My client requirement is process 100 files  from biztalk with in 5 min ,actually it is taking 20 min .
    So I decided to created same instance of the application with multiple time in BTS admin console ,as I understand biztalk admin console never allow to install same
    schema’s with multiple  time .
    Any help can be  appreciate ..

    BizTalk will automatically process multiple messages on separate threads so you may need to tune your system. The following link should get you started:
    http://social.technet.microsoft.com/wiki/contents/articles/7801.biztalk-server-performance-tuning-optimization.aspx
    Another possibility is to set the Batch Size property on your receive location if the adapter uses batch size to determine how messages are picked up.  As an example, it you want  the MSMQ adapter to immediately pick up messages and start
    to process them, set the batch size to 1.
    You may also need to distribute the processing across multiple BizTalk servers by installing BizTalk on additional servers and joining the existing BizTalk group.
    David Downing... If this answers your question, please Mark as the Answer. If this post is helpful, please vote as helpful.

  • Single report with multiple queries OR multiple reports with single query

    Hello Experts,
    I have a confusion regarding Live Office connection for many days. I asked many people but did not get a concrete answer. I am re-posting this question here and expecting an answer this time.
    The product versions that I am using are as follows:
    FrontEnd:
      BOE XI 3.1 SP4 FP 4.1
      Xcelsius Enterprise 2008 SP4
    Backend:
      SAP BW 7.0 EHP1
    I have created a dashboard which is getting data from a webi report using LO connections.
    The webi report has five report parts which are populated by five different queries.
    Now my question is, when the five LO connections are refreshed, is the webi report refreshed five times or just once?
    If the report is refreshed five times, then I guess it is better to have five different webi reports containing single report part, because in that way we can prevent same query being executed multiple times.
    SO what is the best practice- to have a single report having multiple queries - OR - to create multiple webi reports with single query?
    Thanks and Regards,
    PASG

    HI
    I think Best Practice is Multiple reports with single query
    Any way If LO connections refresh 5 time the query will refresh 5 timesRegards
    Venkat

  • Handling multiple database with 10g CONSOLE

    Hello list,
    How do we handle multiple databases with 10g Enterprise Console?
    We are running Oracle 10.1.0.2.0 on Windows 2003 server. I have one database setup but I need to install more databases and am having difficulty accessing and managing the second database. thanks for your input.

    may be you can try the following:
    1) create a file named new_target.xml with the following:
    <Target TYPE="oracle_database" NAME="DBAPV9.WORLD" DISPLAY_NAME="DBAPV9">
    <Property NAME="OracleHome" VALUE="/opt/oracle/app/oraadm9i/product/9.2.0.4"/>
    <Property NAME="UserName" VALUE="sys" ENCRYPTED="FALSE"/>
    <Property NAME="password" VALUE="thepassword" ENCRYPTED="FALSE"/>
    <Property NAME="Role" VALUE="sysdba"/>
    <Property NAME="MachineName" VALUE="machine.domain"/>
    <Property NAME="Port" VALUE="1521"/>
    <Property NAME="SID" VALUE="DBAPV9"/>
    </Target>
    replace as appropriate
    2) Execute emctl config agent addtarget new_target.xml
    3) Execute emctl stop dbconsole
    4) Execute emctl start dbconsole

  • When iam loading multiple datatargets with single datasource request failed

    when iam loading multiple datatargets with single datasource request failed
    i want to delete the  bad request at a time in all datatargets

    Hi Neeraj,
    The only thing you can do is go in to theMonitor screen of that IP and select the datatargets from the Monitor screen.In the next screen you can see all the targets included in the IP at the top.But the only bad thing is you have to manually delete the Bad request only from each target.
    Regards
    Sandeep

  • Multiples databases on single server

    Hello,'
    I need some of the expertise opinions what are the cons and pros of having multiple databases on a single server? we have about 150 GB size of the database with millions of the recods in few tables. The reason is we have to keep one database up, while the other database is upgrading to the users. but i am little conscerned having both on same server. But we dont have an another server to accommdate, so multiple databases or multiple schemas on same box? which on has less overhead and what are the pros and cons...
    Thank you.

    couldlet me know what if i create an another schema in the existing database, do i create a separate tablespaces?
    -- You can create another schema in the existing database under same tablespace or different. Whatever makes sense for your application/database. Please note when you upgrade database then none of the schemas going to be available since they are part of same database.
    our golas is when one db is going through upgrades another should be up and running. as you suggested can i create on 'D" drive in 2 different oracle homes for each of these databases? in this case when i shutdown one db other will be still available to users right...
    please advise.
    -- Basically you will have 2 Oracle Homes on D drive. Something like D:\oracle_home\db_1 and D:\oracle_home\db_2 or whatever you directory/path names.. And database(s) can be located on same or (better) different drive.

  • Help with Oracle Entity Framework and synonyms

    Hi.
    I have some troubles using schemas and synonyms of tables. It means that we are working with diferent schemas, one of those is the owner of tables and other one use synonyms with permissions to access, modify and delete in these tables, this one is the schema that the application use. So whats the way to use this synonyms to tables using the application schema with Entity Framework?
    While I'm using the application data schema I couldn't get data from tables, because the application schema doesn't have tables just use synonyms to them.
    Thanks in advanced
    Cesar.

    I have the same problem. I have created a data connection in the VS2010 server explorer to my oracle database. In the filter I have added the schemas that my user id has access to and the tables are shown in the server explorer. However, when I go through the ADO.NET entity wizard, the tables are not shown.

  • Mvc with oracle entity framework

    Hi,
    I am new to both MVC and Oracle EF...i have installed the necessary components (ODAC beta 3) and tried out the tutorial that oracle has put up and was able to successfully finish it...
    Now i want to create a new MVC 3 app (based on MVC Movie tutorial available online) ...
    I have a model generated from my oracle database..however when i add a controller in MVC, the controller does not seem to recognize my model..What do i need to do so that controller can recognize the model that i generated from oracle database..????
    Is there an example out there that builds an asp.net MVC app using oracle entity framework??
    Thanks.

    Hello,
    is a week that I document but I still have a bit of confusion.
    Work on Oracle 11g with VS2010 I installed ODTwithODAC112030.
    I have to make a data entry form after the registration of an account.
    Can I create an application with MVC and EntityFramework then using Razor for pages CSHTML?.
    WHAT HAVE I DONE:
    1) Creating the Oracle schema QUESTIONARIO.
    2) Execution of InstallAllOracleASPNETProviders.sql
    3) Create application with MVC 3
    4) Insert the web.config connection parameters
    <connectionStrings>
        <add name="OraQuestConnString" connectionString="DATA SOURCE=...;....;USER ID=QUESTIONARIO;PASSWORD=*****" providerName="Oracle.DataAccess.Client" />
    5) Insertion of the parameters in the web.config for the management of user profiles
    <membership defaultProvider="OracleMembershipProvider">
    <profile>
            <providers>
              <clear />
              <add name="OracleProfileProvider" type="Oracle.Web.Profile.OracleProfileProvider, Oracle.Web, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342" connectionStringName="OraQuestConnString" applicationName="questionario_casa_ufficio" />
            </ Providers>
          </ Profile>
          <roleManager enabled="true" defaultProvider="OracleRoleProvider"> .......
    6) The application works and I registered users ORA_ASPNET_USERS etc..
    7) I have created the table "Questionnaire" in the DB
    8) I have created the Model of table "Questionnaire"
    9) I created the corresponding Controller and the Views pages with Razor who created in the "Views/Questionnaire" directory all management pages (Index.cshtml - Create.cshtml - Edit.cshtml - Delete.cshtml)
    10) when the application starts tells me I can not open the databasel SQL-Server, I suppose that it work only with SQL Server!! Or did I do something wrong?
    11) Then I create the Model from DATABASE using "ADO. NET Entity Data Model"
    12) But I did not understand if I can use the EDMX Model to create pages with Razor or with another tool.
    13) Is there an automated way to create pages of data management starting from the Model EMDX or do I have to create them all manually?
    Please help me.
    Thank you very much

  • Problems accessing tables in oracle database with ejb entity bean

    I have created a simple server application that uses an entity bean (version 2.0) for an existing table in oracle database, and a session bean that is used as an outside interface for performing operations on that table.
    after deploying the server and client application the client attempts to perform an operation with the session bean remote interface it obtained.
    The session bean uses a locale interface to communicate with the entity bean, but when it tries to use its methods (create, findByXXX) it always get the following Exception: java.sql.SQLException: ORA-00942: table or view does not exist.
    the table of course exists, and the username password I'm using has all the permissions needed for this table.
    note - I'm using the Forte enterprise edition 4.0 as developer tool.
    I'll be glad to get some help.
    Here is the full stack trace of the exception:
    javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: javax.ejb.EJBException: nested exception is: java.sql.SQLException: ORA-00942: table or view does not exist
    javax.ejb.EJBException: nested exception is: java.sql.SQLException: ORA-00942: table or view does not exist
    java.sql.SQLException: ORA-00942: table or view does not exist
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:643)
    at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:1674)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1870)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:314)
    at com.sun.ejb.persistence.SQLEngine.ejb20Finder(SQLEngine.java:226)
    at com.sun.ejb.persistence.PartitionImpl.ejbFinder(PartitionImpl.java:736)
    at com.cti2.telco.core.ejb.entity.userInfo.UserInfoEJB_PM.ejbFindByEmail(UserInfoEJB_PM.java:393)
    at com.cti2.telco.core.ejb.entity.userInfo.UserInfoEJB_PM_LocalHomeImpl.findByEmail(UserInfoEJB_PM_LocalHomeImpl.java:64)
    at com.cti2.telco.core.ejb.UserManagerEJB.authenticate(UserManagerEJB.java:77)
    at com.cti2.telco.core.ejb.UserManagerEJB.authenticate(UserManagerEJB.java:68)
    at com.cti2.telco.core.ejb.UserManagerEJB_EJBLocalObjectImpl.authenticate(UserManagerEJB_EJB
    LocalObjectImpl.java:63)
    at com.cti2.telco.core.ejb.dispatch.TelcoFacadeEJB.userLogin(TelcoFacadeEJB.java:80)
    at com.cti2.telco.core.ejb.dispatch.TelcoFacadeEJB_EJBObjectImpl.userLogin(TelcoFacadeEJB_EJBObjectImpl.java:24)
    at com.cti2.telco.core.ejb.dispatch._TelcoFacadeEJB_EJBObjectImpl_Tie._invoke(Unknown Source)
    at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(GenericPOAServerSC.java:519)
    at com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(GenericPOAServerSC.java:204)
    at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(GenericPOAServerSC.java:112)
    at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:273)
    at com.sun.corba.ee.internal.iiop.RequestProcessor.process(RequestProcessor.java:84)
    at com.sun.corba.ee.internal.orbutil.ThreadPool$PooledThread.run(ThreadPool.java:99)
    ...

    Well it seems like the problems has a simple explanation. The Forte assigns a default table name (<entityName>EJBTable) when creating an entity bean from an existsing table in DB (which is not the same as the one it was created from !!!). Also, for reason unknown, when you deploy these entity beans, it doesn't even create the new table under its new name (even if instructed to).
    So using the Forte we managed to use successfuly only entity beans that were created "from scretch" (when deployed their tables are created).
    Does anyone know how to change the default name the Forte uses, and make it work properly with entity beans created from an existsing table (without going over the xml's) ?

  • Multiple rows with single date

    I am using a CDC control task to extract and load data from our OLTP source to our Data Warehouse.
    For our Date dimension, we have a DateKey which is a
    DATETIME stamp (created using SSAS dimension wizard). Time is always 00:00:00 as a DATETIME
    value is required for populating the dates.
    Our fact table destination uses this DateKey as a FK.
    Our fact table OLTP data source contains multiple records with a single DATE and TIME field. This fine as I can convert the DATE field to a DATETIME using a derived column.
    However, as our Date dimension has granularity of a day, all we require for our fact table is the most recent daily record from our OLTP data source.
    At present, the data flow task is attempting to write all records and failing on PK constraint.
    How would I go about traversing all records for each date and loading only the most recent for that day? Is there a better way to go about this?

    If you wish to get only one record for today, you can simply use in your source query:
    SELECT TOP 1 ... FROM OLTPdata ORDER BY DEATETIMEcolumn DESC
    if you need one record for each date, you may use ranking functions:
    WITH Q AS (
    SELECT
    ROW_NUMBER() OVER (PARTITION BY CAST(DateTimeColumn AS DATE) ORDER BY DateTimeColumn DESC, some tie breaker column) AS ROWNUM,
    FROM  OLTPData
    SELECT * FROM Q WHERE ROWNUM=1

  • Error when make controller with MVC entity framework

    error when make MVC with entity framework, WHY??

    Hi Arif Kalbu,
    It would be better if you could share us the detailed error message, so I could provide useful informaiton or provide the correct forum for this issue, you know that this forum is to discuss the VS IDE.
    But if the real issue is related to the MVC project, maybe the ASP.net forum would be better: http://forums.asp.net. If then, you could get an answer more quickly and professional. Thanks for your cooperation.
    Best Regards,
    Jack
    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.

Maybe you are looking for

  • My iPhone 5s does not send texts and calls fail, anyone know what could be wrong?

    The iPhone 5s is about 140 days old, I called apple yesterday before I knew about this problem and send a diagnostic test to which they said was all good, they said the phone ismy blocked in anyway and that I got a great buy And it's second hand but

  • Exception occured: java.rmi.NotBoundException: ebillRMIImplInstance

    Hi pls help me ... this is the exception i got while running my client jar file... i;m not able to correct it...i'm using netbeans 6.. my client method is as given below... private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {      

  • Excise pass on onTrading material

    hello, could u please tell me how excise /cenvat/registers update or flows in case of trading material,also how to configure the same. thanking u Jalinder

  • UIX:  messageCheckBox - "Unparseable number: "On".

    I use a messageCheckBox to set values that will be posted to a database field of type Number(1). I expect it to post a 1 if the checkbox is selected. Here is the UIX tag: <bc4j:messageCheckBox id="idKUTD" name="Kutd" attrName="Kutd" prompt="KUTD" sel

  • RSCRM_BAPI job cancel

    Hi guys!! I'm trying to execute RSCRM_BAPI (table mode) and I'm trying to execute it in background but the job cancel and no data is loaded to the specified table. When I execute the query in dialog mode, everything is ok and data is retrieved to the