Hi I have the following in my web.config
<entityFramework>
<contexts>
<context type=" Dashboard.Domain.DataContext, Dashboard.Domain">
<databaseInitializer type="Dashboard.Domain.DataContextInitializer, Dashboard.Domain" />
</context>
</contexts>
the problem is that when I now try to scaffold via the gui tools in vs 2010 it throws a design time exception
Unable to retrieve meta data for 'entity type' Failed to set database initlizer of type 'Init type goes here' specified in app config. see inner exception
why does this happen it also happened with the EF 4.1 way of defining the intializer in config.
Thanks
Related
I trying host my project, but when I run svc file then i get exception.
Exception data: System.InvalidOperationException: The convention requires the use of Session, but the "BasicHttpBinding" binding is not supported or is not configured correctly.
What could be the problem?
I tried changing the web.config file but I don't know what the problem is
You can change your binding mode from BasicHttpBinding to WsHttpBinding. Since the default binding method for HTTP is BasicHttpBinding, you can modify it in the <System.ServiceModel>:
<protocolMapping>
<add scheme="http" binding="wsHttpBinding" bindingConfiguration="WsHttpSession"/>
</protocolMapping>
This allows you to modify the binding.
I am trying to make the change from leveraging entity framework on my Local SQL DB to my production oracle database. I have gone as installing oracle.entityframework via nuget and making the required changes to my web.config file.
<dataSources>
<dataSource alias="<DatasourceName>" descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xxx.xx.xx.xxx)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=<serverName>))) " />
</dataSources>
<add name="TestDBContext" providerName="Oracle.ManagedDataAccess.Client" connectionString="User Id=UName;Password=PW;Data Source=<DatasourceName>" />
<provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
With some changes to the default schema settings I got the update-database command executing successfully and can see the corresponding db tables are created in my oracle instance, however when I hit run on my app I receive a name is already used by an existing object error when my code attempts to make its first db call as seen in the attached screenshot.
Already Exists Error ScreenCap
I suspect that I have missed something regarding the creation and deletion of the table at run time but am at a loss, any help would be greatly appreciated.
Also regarding versioning. I using MVC 5.2.3 with EF 6
Thanks
Why can't I "Add Service Reference" in Visual Studio to this odata endpoint:
<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx" Version="3.0">
<edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="3.0">
<Schema xmlns="http://schemas.microsoft.com/ado/2009/11/edm" Namespace="nsuli_com">
<EntityType Name="EntityType0">
<Key>
<PropertyRef Name="DateS"/>
</Key>
<Property Name="DateS" Type="Edm.DateTime" Nullable="false"/>
</EntityType>
<EntityContainer Name="us">
<EntitySet Name="ImportedSeries_NFPDates" EntityType="nsuli_com.EntityType0"/>
</EntityContainer>
</Schema>
</edmx:DataServices>
It works from LINQPad 4 using the driver "WCF Data Services 5.5 (OData 3)"... but "Add Service Reference..." shows the error:
There was an error downloading 'http://nsuli.com/odata/us/_vti_bin/ListData.svc/$metadata'.
The request failed with HTTP status 404: Not Found.
Metadata contains a reference that cannot be resolved: 'http://nsuli.com/odata/us/'.
The content type application/xml;charset=utf-8 of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 354 bytes of the response were: '<?xml version="1.0" encoding="utf-8"?><service xml:base="http://nsuli.com/odata/us/" xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom"><workspace><atom:title type="text">Default</atom:title><collection href="ImportedSeries_NFPDates"><atom:title type="text">ImportedSeries_NFPDates</atom:title></collection></workspace></service>'.
If the service is defined in the current solution, try building the solution and adding the service reference again.
It should be a metadata format issue. the following service can be used to "Add Service Reference". If you can change the service side code, you can use it as demo.
http://services.odata.org/V3/OData/OData.svc/$metadata
On the other hand, OData can use T4 to generate client code now. You can refer following blog:
http://blogs.msdn.com/b/odatateam/archive/2014/03/11/how-to-use-odata-client-code-generator-to-generate-client-side-proxy-class.aspx
If I do
metadata = metadata.Replace(
"xmlns:edmx=\"schemas.microsoft.com/ado/2009/11/edmx\"",
"xmlns:edmx=\"schemas.microsoft.com/ado/2007/06/edmx\""
)
in my $metadata document, then "Add Service Reference" works just fine...........
I have followed the infocenter docs to setup Worklight on Liberty and Oracle Database all on Windows 2008.
(http://pic.dhe.ibm.com/infocenter/wrklight/v6r0m0/topic/com.ibm.worklight.help.doc/devref/t_transporting_apps_and_adapters.html - Deploying IBM Worklight applications to test and production environments)
When I start the liberty server, I get this error on the browser
Exception thrown by application class 'com.worklight.core.auth.impl.AuthenticationFilter.doFilter:110'
javax.servlet.ServletException: Worklight Project not initialized
at com.worklight.core.auth.impl.AuthenticationFilter.doFilter(AuthenticationFilter.java:110)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:194)
at [internal classes]
Going thru the logs, it shows it did not start because the HSQLDB driver is not found.
The server.xml has the following:
<application id="finance" name="finance" location="finance.war" type="war">
<classloader delegation="parentLast">
<commonLibrary>
<fileset dir="${shared.resource.dir}/worklight/lib" includes="worklight-jee-library.jar"/>
</commonLibrary>
</classloader>
</application>
<library id="worklight/OracleLib">
<fileset dir="${shared.resource.dir}/worklight/oracle" includes="*.jar"/>
</library>
<!-- Declare the IBM Worklight Console database. -->
<dataSource jndiName="worklight/jdbc/WorklightDS" transactional="false">
<jdbcDriver libraryRef="worklight/OracleLib"/>
<properties.oracle driverType="thin" URL="jdbc:oracle:thin:#localhost:1521:ORCLWL" user="WORKLIGHTDIS" password="WORKLIGHTDIS"/>
</dataSource>
I took a step further and checked how the WAR file links to database jndi entries. Going thru the web.xml file I found this:
<resource-ref>
<description>Worklight Server Database</description>
<res-ref-name>jdbc/WorklightDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
The res-ref-name is slightly different from what is declared in the server.xml. Bear in mind that these entries were created by the ant script. This seems to be inconsistent from what the war file contains (created by the WL Studio).
Anyway I gave it a try and changed the server.xml jndi entry to be exactly the same as the web.xml entry (jdbc/WorklightDS). When I restarted the liberty server It did not change the final result at all. The error message and the HSQL driver thing kept showing in the log.
This is the exception
nested exception is java.lang.RuntimeException: java.lang.ClassNotFoundException: Class org.hsqldb.jdbcDriver not found in Worklight platform or project /finance
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
Later on I found out that if I change the element in the server.xml to be worklight value for all atributes it works. How odd it is.
<application id="worklight" name="worklight" location="finance.war" type="war">
Please, any help is much appreciated to help me understand and fix it.
The error message "java.lang.RuntimeException: java.lang.ClassNotFoundException: Class org.hsqldb.jdbcDriver not found in Worklight platform or project ..." is indeed misleading. It should better read something like "Worklight server cannot be started because no data-source is bound to resource reference: 'jdbc/WorklightDS'. Re-configuring the server will solve this problem. for more information search for "Creating and configuring the databases" in IBM Worklight information center."
The explanation for the error message is that by writing <application id="finance" name="finance" location="finance.war" type="war"> you selected a context root /finance, according to the WebSphere Liberty rules at Deploying a web application to the Liberty profile. For this context root, you need to write
<dataSource jndiName="finance/jdbc/WorklightDS" transactional="false">
This is similar to how JNDI environment entries need to be declared for Worklight (see here).
I'm trying to get sqlite working with linq. So far I've:
installed the ADO.net providers from http://sourceforge.net/projects/sqlite-dotnet2/files/SQLite%20for%20ADO.NET%202.0/
installed both the 32 and 64 bit sqlite .net from http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki
Now I can create an entity data model using an sqlite database as the source. Whenever I try to create a new instance of the data model (in a wpf component that is getting displayed) I get the following exception:
A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll
Additional information: 'The invocation of the constructor on type myprogram.mycomponent' that matches the specified binding constraints threw an exception.' Line number '13' and line position '37'.
The mycomponent constructor is simply:
private void myprogram()
{
InitializeComponent();
pricesEntities pe = new pricesEntities();
}
When I open the design view for the window that displays the component, I get an
ArgumentException was thrown on "mycomponent": Cannot create an instance of "mycomponent".
An Unhandled Exception has occurred
The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.
at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
at System.Data.EntityClient.EntityConnection..ctor(String connectionString)
at System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString)
at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName)
at myprogram.pricesEntities..ctor() in <path>\prices.Designer.cs:line 34
at myprogram.ItemList.InitializePriceList() in <path>\ItemList.xaml.cs:line 34
at myprogram.ItemList..ctor() in <path>\ItemList.xaml.cs:line 29
My app.config contains the following connection string:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="pricesEntities" connectionString="metadata=res://*/prices.csdl|res://*/prices.ssdl|res://*/prices.msl;provider=System.Data.SQLite;provider connection string='data source="<path>\prices.db"'" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
I tried copying the app.config file to the directory of the executable, as was suggested here and other places. That did not help. Note that this is a different issue than The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid
I have only one project (a wpf application) that I am trying to get to work.
Figured out it was because it was an assembly build for the 2.x runtime, so I added the useLegacyV2RuntimeActivationPolicy element to my app.config and that resolved the issue.