Entity Framework in WPF Application - Using Statement or Implement IDisposable

I have a WPF application that uses Entity Framework.
I have implemented a Repository that implements IDisposable, that holds my EF context.  When the application starts up I new up a Repository, which news up an EF context, then when the application shuts down, I dispose of my Repository, which disposes
the EF context as well.
The end result is that my context remains open during the entire lifetime of the application.  
I've been reading up on EF, and all the examples put the operations against the EF context in a using statement.  Is that the preferred approach?  What is the priority: to keep the context open briefly, or just to make sure you properly dispose
of it when you're finished with it.
Thanks.
Aaron

>
https://msdn.microsoft.com/en-us/library/aa355056(v=vs.110).aspx
That link is only for WCF and it's broken implementation of the Dispose pattern.
>I have been burnt in doing it where the connection was not closed or disposed when it short-circuted out of the Using statement on exception
If so, it was a bug.  You should expect that not to happen.
'using' will close your connection, unless the connection was open before the DbContext and was passed in.  'using' is the safest way to ensure that the connections are closed in a timely manner.
David
David http://blogs.msdn.com/b/dbrowne/
I absoultly do not agree with you. I have been burnt in using the Using statment. And it was along the lines that an excpetion was thrown within the Using statement and no closing of the connection or dispoiong of it ever occured, which is what the WCF example
is showing on how a Using statement can be short-circuted and things can go wrong.
I don't care if the Using statement issue is being shown on a WCF typed cleint. I do the same thing in using straight up ADO.NET or EF, becuase I have been burnt by the Using statement, and I dont use them to open,  close or dispose of a connection.

Similar Messages

  • Unable to connect to wpf application using SQLEXPRESS 2012

    Hi,
    I am currently working on WPF project that uses SQLEXPRESS 2012 DB and EF 5.0. 
    I was able to connect to the DB when it was hosted on the same PC. I now hosted the DB to a differernt PC and trying to access it through WPF app, but getting the error as "The underlying provider failed to open". I went through various forums
    to fix the issue but none of the solutions provided resolved the issue. Below is my connection string
     <add name="SAPActivityContext" connectionString="metadata=res://*/SapEntity.csdl|res://*/SapEntity.ssdl|res://*/SapEntity.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=192.168.0.100\SQLEXPRESS;initial
    catalog=Sap;persist security info=True;user id=sa;password=Pass@word7;MultipleActiveResultSets=True;&quot;" providerName="System.Data.EntityClient" />
    The connection string has been refactored based on the various inputs provided in different forums.
    Please help.

    Hi Priyankaks,
    According  your description, you fail to connect to a SQL Server 2012 Express database from WPF application. Cloud you please post the full error message for further analysis? You can check Windows Event Viewer or SQL Server Error log to see
    if there is additional information.
    From my knowledge, the error “The underlying provider failed on Open” always occurs when the connection string is incorrect. I recommend you create a surely working connection string via the following method.
    Create a new project, add your Entity Framework Data Model and select your required connection, click “Test Connection” to get a working connection string. Then copy and paste the connection string in the web/app.config of your own project. For more
    details, please review this similar
    thread.
    There is also a blog about error “The underlying provider failed on Open“in Entity Framework application
    for your reference.
    http://blogs.msdn.com/b/dataaccesstechnologies/archive/2012/08/09/error-quot-the-underlying-provider-failed-on-open-quot-in-entity-framework-application.aspx
    Thanks,
    Lydia Zhang

  • Latest Entity Framework version to be used with DB2

    I am looking for a Entity Framework Provider for DB2 (UDB) in my local Windows 7 machine to implement Entity Framework 6.0 with DB2. Is that provider available?
    If not any Provider from IBM is supporting it?
    If both of the above questions turned negative, for which older EF version (5,4 etc...) has Microsoft/IBM Entity Provider to work with DB2? what's the name of the dll reference?

    Hello JAISH,
    For issues regarding DB2, it is beyond the scope of our support for this forum, i suggest you could post it to the DB2 forum to confirm how to get the last version of EF provider for DB2:
    https://www.ibm.com/developerworks/community/forums/html/forum?id=11111111-0000-0000-0000-000000000842
    Thanks for your understanding.
    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.

  • A proper solution to a WPF application using On Screen Keyboard

    Hi.
    I´ve been working for some time on a good OSK solution for my WPF apps, that are running on a tablet. But it´s hard working with the OSK.exe and tabtip.exe, because of several bugs, strange behaviour and no standardized solution to this ordinary problem.
    What I (probably) need is a custom textbox control, which inherits from System.Windows.Controls.TextBox, and overrides some methods.
    The simple requirements for this textbox should be:
    1. When a user clicks in a textfield, the tabtip.exe (or alike) keyboard should pop up at the bottom of the screen (default).
    2. If the keyboard pops up on top of the textbox, the contentframe should scroll so that the textbox is visible.
    3. When the textbox loses focus, the keyboard should close automatically, except if the user clicks on another textbox.
    This seems like pretty standard behaviour right? Well I´ve looked a long time for solutions (there is no standard microsoft way which is kind of weird), and as said I´ve tried making my own but with no luck. For example, sometimes when I try to kill the process,
    it fails. When I click the close button in the upperright corner on the keyboard, like 5-6-7 times, it closes. The behaviour from PC to tablet is not consistent. The ScrollViewer.ScrollToVerticalOffset(x); sometimes doesent work on a tablet, and so on.
    So does any of you know a good solution to this common problem?

    Hello Farsen.
    I have been creating a Win8 app for my business and in learning that I discovered they have "LayoutAware" pages.  The basic idea behind the LayoutAware page is that they move the page up when the keyboard is active and that different layouts
    can be set for the tablet orientation.
    You could apply the same basic concept to WPF using VisualStateManager.
    Here is a real quick example....
    <Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
    x:Class="WpfApplication27.MainWindow"
    x:Name="Window"
    Title="MainWindow"
    Width="640" Height="480">
    <Grid x:Name="LayoutRoot">
    <VisualStateManager.VisualStateGroups>
    <VisualStateGroup x:Name="VisualStateGroup">
    <VisualStateGroup.Transitions>
    <VisualTransition GeneratedDuration="0:0:0.2"/>
    </VisualStateGroup.Transitions>
    <VisualState x:Name="KeyboardOpen">
    <Storyboard>
    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="grid">
    <EasingDoubleKeyFrame KeyTime="0" Value="-130"/>
    </DoubleAnimationUsingKeyFrames>
    </Storyboard>
    </VisualState>
    <VisualState x:Name="KeyboardClosed"/>
    </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>
    <VisualStateManager.CustomVisualStateManager>
    <ei:ExtendedVisualStateManager/>
    </VisualStateManager.CustomVisualStateManager>
    <Grid x:Name="grid" HorizontalAlignment="Center" Height="41.92" VerticalAlignment="Center" Width="200" RenderTransformOrigin="0.5,0.5">
    <Grid.RenderTransform>
    <TransformGroup>
    <ScaleTransform/>
    <SkewTransform/>
    <RotateTransform/>
    <TranslateTransform/>
    </TransformGroup>
    </Grid.RenderTransform>
    <TextBox TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" GotFocus="TextBox_GotFocus" LostFocus="TextBox_LostFocus"/>
    <Button Content="Button" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="75"/>
    </Grid>
    </Grid>
    </Window>
    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Text;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Shapes;
    namespace WpfApplication27
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    public MainWindow()
    this.InitializeComponent();
    // Insert code required on object creation below this point.
    private void TextBox_GotFocus(object sender, System.Windows.RoutedEventArgs e)
    Process.Start("TabTip.exe");
    VisualStateManager.GoToElementState(LayoutRoot, "KeyboardOpen", true);
    private void TextBox_LostFocus(object sender, System.Windows.RoutedEventArgs e)
    Process[] processlist = Process.GetProcesses();
    foreach(Process process in processlist)
    if (process.ProcessName == "TabTip")
    process.Kill();
    VisualStateManager.GoToElementState(LayoutRoot, "KeyboardClosed", true);
    break;
    Now, I'm sure folks get right tired of my shouting Blend. But... if you have Blend you could make short work of setting this up.
    If you open your project in Blend, select the xaml page with the design view showing. 
    Select the "States" tab.
    Click the "Add State" button and you can double click the state that appears to rename it or rename it directly in xaml.
    Change the Transition Duration if desired.
    Select the state and you will see that "State Recording" is active.
    Just move your items where you want them for that state.
    I hope that gives you some ideas.
    ~Christine
    Edit. The red ellipse in the image above circles the "Add State" button.

  • Entity Framework reference dll to use

    Hello
    I installed ODAC successfully,
    I created model.edmx successfully, where i choose some tables and SPs,
    Now, I want to execute query against table
    Which reference to be added to execute a query
    Regards,

    This OBE will take you step by step on what you need to do, including what EF reference to use.
    http://download.oracle.com/oll/obe/EntityFrameworkOBE/EntityFrameworkOBE.htm

  • Need some samples to make Entity framework interact with WPF

    HI guys,
    I need to create an app which will query all details about customer from very big database for different search crieria. I don't have any sp to call individual section details of customer. so i planned to go with Entity framework and WPF. Both are new to
    me.
    Could someone please help me  with creating good WPF application (beautiful look and feel) & entity framework interaction with DB?
    or any other to make this requirement in an easy way with latest technologies.. All i need some good UI for searching customer details..
    thanks in advance
    Regards
    bala
    Balamurugan

    I (obviously) agree my sample is something to look at.
    Since it's the first in a series rather than a complete guide it cuts a number of corners.
    One to emphasise is that I almost never allow a user to edit in a datagrid directly.
    I either use popups so they are forced to work on one record at a time.
    Or I have a different usercontrol for a particular task a user does - like raising an order say.
    The second in the series is on the way.  Not sure when exactly but next month.  I have the code ready but I've not written the article for it yet.  Depending on your timescales you might find that useful.
    Also read this:
    http://social.technet.microsoft.com/wiki/contents/articles/26673.wpf-collectionview-tips.aspx
    That explains some dynamic filtering on the client and touches on a way to haul bits of a HUGE set of data onto the client.
    You definitely don't want to do that all at once.
    The thing to emphasis is you should always be looking to give the user a subset to look at.
    Think in terms of  a maximum of 200 to 300 records at a time in a datagrid.
    Linq with EF offers pass through queries.
    You will almost certainly want to use that feature in order to pick all the customers starting with the letter A or in town xyz or whatever.
    You use  linq on the client and it is turned into sql on the database.
    One thing which is sort of odd about linq is that the sql is generated when you iterate a collection.  That has an odd benefit which is great for flexible querying.
    You can base one linq query on another and chain your various criteria together.
    That only generates sql when you use that end result.
    Hope that helps.
    Recent Technet articles:
    Property List Editing;  
    Dynamic XAML

  • 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.

  • Entity Framework : Outer Joins

    Hello,
    I'm trying to solve some issues with an application that I'm developing....
    I have a problem with outer joins:
    var query = (from i in dbo.ITEMs
                             join o in dbo.ORGANIZATIONs on i.ORGSEQNO equals o.ORGSEQNO
                             join iv in dbo.ITEMVERSIONs on i.ITEMSEQNO equals iv.ITEMSEQNO
                             join it in dbo.ITEMTARGETs on iv.VERSIONSEQNO equals it.VERSIONSEQNO
                             join id in dbo.ITEMDESCRIPTIONs.DefaultIfEmpty() on it.ITEMTARGETSEQNO equals id.ITEMTARGETSEQNO
                             select i).AsQueryable();
    If I remove the DefaultIfEmpty the query works as expected, with the "DefaultIfEmpty" in, it generates a sub-select that doesn't execute.
    1 ORA-00904: "SingleRowTable3"."X": invalid identifier SQL1.sql 44 23
    This is the occorring error.
    Thanks for your help.

    You can check my thread Entity Framework generates invalid oracle sql.
    Generally Entity Framework sometimes generates joins using APPLY which does not work on NON SQL SERVER system.

  • Entity Framework - Execute Stored Procedures

    I want to execute stored procedure using entity framework.
    I am using entity framework 6.
    The stored procedure has SELECT and RETURN statement.
    How can I read the output from SELECT and RETURN statements using
    dbContext.Database.ExecuteSqlCommand or dbContext.Database.SqlQuery statement ?

    Hello Sumit Kadam,
    >> The stored procedure has SELECT and RETURN statement.
    For the select statement, Entity Framework would support natively:
    http://www.entityframeworktutorial.net/stored-procedure-in-entity-framework.aspx
    For the return statement, we could use the dbContext.Database.SqlQuery statement as below to fetch the value:
    var returnCode = new SqlParameter();
    returnCode.ParameterName = "@ReturnCode";
    returnCode.SqlDbType = SqlDbType.Int;
    returnCode.Direction = ParameterDirection.Output;
    // assign the return code to the new output parameter and pass it to the sp
    var data = db.Database.SqlQuery<Order>("exec @ReturnCode = ProGetOrder", returnCode);
    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.

  • Heavy Locks on the Entity Framework Database

    Dears,
    We are having a database which was developed using a Entity Framework, the web application was built on the top of Windows Work Flow Engine (WWF) and there are some stored procedures given below, which was generated by WWF. On which there are numerous heavy
    locks are happening and we are not aware of how fix this issue.
    [System.Activities.DurableInstancing].[RecoverInstanceLocks]
    [System.Activities.DurableInstancing].[ExtendLock]
    Any solution to above problem or if you know the source of the problem, it would be much helpful for us

    Dear pituach,
    First i would like thank you for your replies, hope we could reach some concrete solution which may more people. 
    To
    start doing something on the below procedures, first we need to know what was purpose of this procedures, this procedures are accessing some of the below listed tables. I think it was some standard behavior of Entity Framework System. The below tables and
    some of procedures are injected into the database with a purpose, i would like to know what was it.
    [System.Activities.DurableInstancing].[DefinitionIdentityTable]
    [System.Activities.DurableInstancing].[IdentityOwnerTable]
    [System.Activities.DurableInstancing].[InstanceMetadataChangesTable]
    [System.Activities.DurableInstancing].[InstancePromotedPropertiesTable]
    [System.Activities.DurableInstancing].[InstancesTable]
    [System.Activities.DurableInstancing].[KeysTable]
    [System.Activities.DurableInstancing].[LockOwnersTable]
    [System.Activities.DurableInstancing].[RunnableInstancesTable]
    [System.Activities.DurableInstancing].[RunnableInstancesTable]
    [System.Activities.DurableInstancing].[ServiceDeploymentsTable]
    [System.Activities.DurableInstancing].[SqlWorkflowInstanceStoreVersionTable]
    Working as a Senior Database Analyst & Architect at Ministry of Higher Education in KSA

  • Issue with worksheet.Select(true) after hosting Excel window in WPF application

    The issue is with Office 2013.
    We are hosting excel workbook window in WPF application using HwndHost class. In overridden BuildWindowCore method of HwndHost class, we are creating a MDICLIENT Window and setting this MDICLIENT window handle as parent for Excel
    main window handle and returning HandleRef object of MDICLIENT window handle from BuildWindowCore method.
    Once HwndHost control is loaded, we are selecting sheet of excel in the loaded event of HwndHost control. The code for selection of sheet is given below.
    dynamic workSheet =
    this.excelApplication.Workbooks[1].Worksheets[sheetName];
    this.excelApplication.Workbooks[1].Activate()
    workSheet.Activate();
    workSheet.Select(true);
    The first time execution of
    workSheet.Select(true)
    halt for few seconds and then it throws exception “System.Runtime.InteropServices.ComException”
    with message “The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))”.
    But it executes successfully without delay on subsequent calls. Sometimes the execution halt for minutes on different Systems.
    This absurd behaviour is seen only once in application instance life time and that too after excel window gets loaded in WPF application. If we execute
    workSheet.Select(true)
    before loading of window then it executes properly. Once
    workSheet.Select(true)
    executed for first time with exception, it executes successfully without delay on subsequent calls.

    No, I dont have any macro in the sheet and it is happpening with all workbooks. The problem is consistent with all workbooks and also it throws exception only for first time in the application. If I execute it again in same application instance, it works
    properly.

  • How to create ViewModel in an MVVM application using entity framework where database has many-to-many relationship?

    I have started developing a small application in WPF. Since I am completely new to it, to start with I took a microsoft's sample available at
    Microsoft Sample Application and following the pattern of the sampke I have been so far successful  in creating four different views for their corresponding
    master tables. Unfortunately, I have got stuck up as the sample does not contain pattern for creating ViewModel when there is a many-to-many relationship in the database. In my application, I have the following data structure:
    1. Table Advocate(advId, Name)
    2. Table Party (partyId, Name)
    3 Table Case (caseId, CaseNo)
    4. Link Table Petitioner (CaseId, PartyId)
    5. Link Table Respondent (CaseId, PartyId)
    6. Link Table EngagedAdvocate(CaseId, advId)
    7. Link Table EngagedSrAdvocate(CaseId, advId)
    In the scenario above, I am a bit confused about how to go forward creating the required ViewModel which would render me to have multiple instances of Petitioners, Respondents, Advocates and SrAdvocates.
    Please explain details in step by step manner considering that whatever work I have completed so far is a replica of Microsoft's sample referred above. I would also like to mention that I have developed my application
    using VB.net. So please provide solution in vb.net.
    After getting many-to-many relationship introduced into my application, it would achieve one level above the sample application and I would like to share with the community so that it could be helpful to many aspiring developers seeking help with MVVM.

    Hi ArunKhatri,
    I would suggest you referring to Magnus's article, it provides an example of how you could display and let the user edit many-to-many relational data from the Entity Framework in a dynamic and data-bound DataGrid control in WPF:
    http://social.technet.microsoft.com/wiki/contents/articles/20719.wpf-displaying-and-editing-many-to-many-relational-data-in-a-datagrid.aspx
    You can learn how to design the ViewModel and the relationship between the entities.
    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.

  • Using both Enterprise library and Entity framework as DAL for same application

    We have been using EF for large amount of data  retrieval in our current application. We faced performance related issues with using EF with large data retrieval and manipulation.
    We need to extend the same project with some additional functionality similar to what currently exists in the application and uses EF.
    For the new functionality, we do not want to use EF and want to use enterprise library for Data access.
    My question is if we use both entity framework for parts of the application data access mechanism and enterprise library for other parts of application data access, are there any known issues?
    if there are any best practices to be followed please share .

    We have been using EF for large dataset retrieval in our current application. We faced performance related issues with using EF for large data set's  .
    Dataset? What are you talking about?  If you are using the salad bowl, the dataset with datatables, then here is the reason not to use them.
    http://lauteikkehn.blogspot.com/2012/03/datatable-vs-list.html
    My question is if we use both entity framework for parts of the application data access mechanism and enterprise library for other parts of application data access, are there any known issues?
    What is Entlib going to buy you in performance? It's going to buy you nothing. You'll be better of going to the EF backdoor, use SQL command objects, inline T-SQL, sprocs, datareder and using custom objects or objects off of the virtual model returning a
    single object or objects in a collction., if you are concerned about performance.
    http://blogs.msdn.com/b/alexj/archive/2009/11/07/tip-41-how-to-execute-t-sql-directly-against-the-database.aspx
    You'll probably be better of going to Entity SQL, using a datareader, collection and using custom objects or objects off of the model, if you are concerned about query performance.
    https://msdn.microsoft.com/en-us/library/vstudio/bb738684(v=vs.100).aspx
    https://msdn.microsoft.com/en-us/library/vstudio/bb387145(v=vs.100).aspx
    https://msdn.microsoft.com/en-us/library/vstudio/bb399560(v=vs.100).aspx
    My question is if we use both entity framework for parts of the application data access mechanism and enterprise library for other parts of application data access,
    are there any known issues?
     A nightmare, no consistency and complete Helter Skelter is what I see. Been there and seen it in action with different technologies doing the same thing in a solution.

  • Deploying LightSwitch applications to IIS using the Oracle Entity Framework

    I have had no sucess running Lightswitch applications on IIS using the Oracle Beta entity framework. Applications work fine from visual studio but after deployment fail when I trying to access an Oracle data entity.
    I have tried deploying to a 2008 V2 server 64Bit running IIS7.5 and also to a 32 bit windows 7 machine running IIS7. Both machines had the entity framework installed and I could connect to Oracle with SQL developer just fine. Briefly in the case of the 64 bit machine I get a bad image exception indicating a 64/32 bit conflict. (App pool switched to allow 32bit). The problem with the 32Bit machine is that the session either hangs or dies with an [Arg_TargetInvocationException]
    In all tests apps could connect to SQL server fine but as soon as I use an Oracle connection they fail. It would very helpfull if someone could confirm that they have managed to use the Entity framework Beta with Lightswitch and IIS.
    Thanks in advance
    Edited by: user12218662 on 08-Oct-2011 11:35
    Edited by: user12218662 on 08-Oct-2011 11:37

    Both hosts working now. Initially I created a service account for the aspnet service with extended rights and assigned this to the application pool. This subsequentluy turned out not to be required - ApplicationPoolIdentity works fine. What worked was as follows:
    1. On a 64 Bit host you need to set the application pool to Enable 32 Bit Applications (Right click the relevant app pool in IIS and select advanced)
    2. Switch off windows authentication for the application (leaving just anonoymous authentication) This was required on both hosts
    3. On the 32 Bit host copy tnsnames to the oracle client admin folder - the framework seems to ignore theTNS_ADMIN environment variable. Probably more to this but its working for now.

  • How to use Application Roles with Entity Framework

    How does one call sp_setapprole before a connection used by an Entity Framework object context closes, since the context opens and closes its own connection automatically, as needed? The only relevant event available on a store connection
    (DbConnection ) is StateChange , which does not include a
    ConnectionState of Closing . Attempting to call
    sp_setapprole when ConnectionState is Closed results in, "A severe error occurred on the current command. The results, if any, should be discarded."

    Yes, I realize that I need to call sp_setapprole on an open connection and that I can use
    ExecuteNonQuery or similar mechanisms. What I need to determine is how to do this
    automatically while using the entity framework.
    As I mentioned in my initial inquiry, the EF store connection, which is simply a DbConnection under the covers, does not expose an event (such as Closing) that would allow me to invoke
    sp_setapprole before a connection is closed. The only close event we are given is
    Closed , which is too late to do any good. I'm hoping to avoid burdening our systems with having to manually manage the connection.

Maybe you are looking for

  • Photoshop 7 running slow on Windows 8

    I have Photoshop version 7 running on a new Windows 8 system. I ran in previously on a Windows 7 system. I don't know all the system details, but i know there is plenty of RAM (16 gb), plenty of space, plenty of everything, and it is compatible, howe

  • Fastest way to learn Dreamweaver, Photoshop, Illustrator, etc?

    I've been taking online classes in these software programs at my community college. I find this tedious and frustrating at times. I've gotten to "advance beginner" level but nothing is easy. What's the most efficient way to learn these programs fluen

  • BDC problem session hangs on F4.

    Hi all, suppose a material code has been created using mm01, know while performing valuation extension of this material code through  bdc call transaction method , Problem arises when a wrong plant is given through flat file to a particular matnr , a

  • After factory reset information shared across devices won't load

    Hello. I recently did a factory reset on my MacBook Air. I backed up my iphoto library and itunes library to external hard drive and was able to load those fine. But I am still having a problem with syncing media and data across devices. Maybe I'm mi

  • AP Client Authentication Issues

    Hello. I have three 1200 series access points running in autonomous mode that need to allow handheld computers to connect. The handhelds need to authenticate using EAP. The AP's are properly listed and configured in the ACS and the handhelds are prop