Hi Jeremi,
My point was, why the default parameter name is hard coded? it would be a lot simpler if I could specify it through a configuration file.
Thanks!
--Eulesv
Hi Jeremi,
My point was, why the default parameter name is hard coded? it would be a lot simpler if I could specify it through a configuration file.
Thanks!
--Eulesv
any solution about it ?
Now, it's ok, thanks
Hi all,
I use ODP.NET and version 4.1 of the Enterprise Library, vs 2008. And all is OK.
Now, migrate using ODP.NET Oracle.DataAccess 4.112.2.0 and version 5.0.414.0 of the Enterprise Library, vs 2010, .net 4.0. Using Windows7 64 bits.
Now, I have download source code of http://entlibcontrib.codeplex.com/
I open Data.OdpNet.QuickStarts.sln and change references to Enterprise Library 5.0.414.0. and change Target Framework to .NET 4.0. Now it works using right configuration.
Both 4.1 and 5.0 dlls are on GAC in Windows 7 64 bits. EntLibContrib.Data.OdpNet is in GAC too. All is OK.
I have now a machine with Windows Server 2008 64 bits, on which is installed Enterprise Library 5.0 and 4.1. Both 4.1 and 5.0 dlls are on GAC and must be.
EntLibContrib.Data.OdpNet is in GAC too.
I get this error:
Unable to cast object of type 'EntLibContrib.Data.OdpNet.Configuration.OracleConnectionSettings' to type 'Microsoft.Practices.EnterpriseLibrary.Data.Oracle.Configuration.OracleConnectionSettings'.
Any solution about it ?
Thanks in advanced.
References: http://entlib.codeplex.com/workitem/31936
My config is:
<section name="oracleConnectionSettings" type="EntLibContrib.Data.OdpNet.Configuration.OracleConnectionSettings, EntLibContrib.Data.OdpNet, Version=4.0.0.0, Culture=neutral, PublicKeyToken=709072f976b4c05b" requirePermission="true"/> <system.data> <DbProviderFactories> <add name="EntLibContrib.Data.OdpNet" invariant="EntLibContrib.Data.OdpNet" description="EntLibContrib Data OdpNet Provider" type="EntLibContrib.Data.OdpNet.OracleDatabase, EntLibContrib.Data.OdpNet, Version=4.0.0.0, Culture=neutral, PublicKeyToken=709072f976b4c05b" /> </DbProviderFactories> </system.data> <dataConfiguration defaultDatabase="DAL.Properties.Settings.ConnectionString"> <providerMappings> <add databaseType="Microsoft.Practices.EnterpriseLibrary.Data.Oracle.OracleDatabase, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=709072f976b4c05b" name="System.Data.OracleClient" /> <add databaseType="EntLibContrib.Data.OdpNet.OracleDatabase, EntLibContrib.Data.OdpNet, Version=4.0.0.0, Culture=neutral, PublicKeyToken=709072f976b4c05b" name="EntLibContrib.Data.OdpNet"/> </providerMappings> </dataConfiguration> <oracleConnectionSettings> <add name="DAL.Properties.Settings.ConnectionString"></add> </oracleConnectionSettings> <oracle.dataaccess.client configSource="Config\oracle.dataaccess.client.config"/> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <qualifyAssembly partialName="Oracle.DataAccess" fullName="Oracle.DataAccess, Version=4.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" /> <qualifyAssembly partialName="Microsoft.Practices.EnterpriseLibrary.Data" fullName="Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=709072f976b4c05b"/> </assemblyBinding> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Microsoft.Practices.Unity" publicKeyToken="709072f976b4c05b" culture="neutral" /> <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.1.505.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Practices.Unity.Configuration" publicKeyToken="709072f976b4c05b" culture="neutral" /> <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.1.505.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Practices.EnterpriseLibrary.Common" publicKeyToken="709072f976b4c05b" culture="neutral" /> <bindingRedirect oldVersion="1.0.0.0-4.2.0.0" newVersion="5.0.414.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Practices.EnterpriseLibrary.Data" publicKeyToken="709072f976b4c05b" culture="neutral" /> <bindingRedirect oldVersion="1.0.0.0-4.2.0.0" newVersion="5.0.414.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Practices.EnterpriseLibrary.Logging" publicKeyToken="709072f976b4c05b" culture="neutral" /> <bindingRedirect oldVersion="1.0.0.0-4.2.0.0" newVersion="5.0.414.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling" publicKeyToken="709072f976b4c05b" culture="neutral" /> <bindingRedirect oldVersion="1.0.0.0-4.2.0.0" newVersion="5.0.414.0" /> </dependentAssembly> </assemblyBinding> </runtime>
Error details
Inner exception: Exception has been thrown by the target of an invocation.
Exception type: TargetInvocationException
Source: mscorlib
Target Site: System.Object _InvokeConstructor(System.IRuntimeMethodInfo, System.Object[], System.SignatureStruct ByRef, System.RuntimeType)
The following is a stack trace that identifies the location where the exception occured
at System.RuntimeMethodHandle._InvokeConstructor(IRuntimeMethodInfo method, Object[] args, SignatureStruct& signature, RuntimeType declaringType)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSyntheticConfigSettings.CreateDatabaseData(Type configurationElementType, ConnectionStringSettings settings, IConfigurationSource source)
at Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSyntheticConfigSettings.GetDatabaseData(ConnectionStringSettings connectionString, DatabaseSettings databaseSettings)
at Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSyntheticConfigSettings.<get_Databases>d__0.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSyntheticConfigSettings.<DoGetRegistrations>d__10.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSyntheticConfigSettings.GetRegistrations(IConfigurationSource configurationSource)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.TypeLoadingLocator.GetRegistrationsInternal(IConfigurationSource configurationSource, Func`3 registrationAccessor)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.CompositeTypeRegistrationsProviderLocator.<>c__DisplayClass5.<GetRegistrationsInternal>b__4(ITypeRegistrationsProvider l)
at System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.Unity.UnityContainerConfigurator.RegisterAllCore(IConfigurationSource configurationSource, ITypeRegistrationsProvider rootProvider)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.ChangeTrackingContainerConfigurator.RegisterAll(IConfigurationSource configurationSource, ITypeRegistrationsProvider rootProvider)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer.SetCurrentContainerIfNotSet()
at Microsoft.Practices.EnterpriseLibrary.Logging.Logger.get_Writer()
at ... at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)
Additional error information:
Unable to cast object of type 'EntLibContrib.Data.OdpNet.Configuration.OracleConnectionSettings' to type 'Microsoft.Practices.EnterpriseLibrary.Data.Oracle.Configuration.OracleConnectionSettings'.
Exception type: InvalidCastException
Source: Microsoft.Practices.EnterpriseLibrary.Data
Target Site: Void .ctor(System.Configuration.ConnectionStringSettings, Microsoft.Practices.EnterpriseLibrary.Common.Configuration.IConfigurationSource)
The following is a stack trace that identifies the location where the exception occured
at Microsoft.Practices.EnterpriseLibrary.Data.Oracle.Configuration.OracleDatabaseData..ctor(ConnectionStringSettings connectionStringSettings, IConfigurationSource configurationSource)
< section name="oracleConnectionSettings" type="EntLibContrib.Data.OdpNet.Configuration.OracleConnectionSettings, EntLibContrib.Data.OdpNet, Version=4.0.0.0, Culture=neutral, PublicKeyToken=709072f976b4c05b" requirePermission="true" />
Hi,
I am trying to employ this library for mapping datasource objects to custom business domain objects,
The very first problem: Can anyone point me to where I an find the related Dll files [I mean Mapping.dll...etc]
I have downloaded the 4.1 & 5.0 Contrib., but can not see any dll by that name under the bin.
Any help is appreciated
Thanks
Hi MFCI,
The mapping block came after the last release of EntlibContrib v4.1 so the source and the dll’s are in source control only. If you download the latest source rather than the “download package” you will bet MAB. There should also be a strong named dll there too. Let me know if you have problems.
Cheers… ewdev
From: MFCI [email removed]
Sent: 10 February 2012 20:09
To: sp@ewdev.com
Subject: Mapping Application Block 4.1 [entlibcontrib:304619]
From: MFCI
Hi,
I am trying to employ this library for mapping datasource objects to custom business domain objects,
The very first problem: Can anyone point me to where I an find the related Dll files [I mean Mapping.dll...etc]
I have downloaded the 4.1 & 5.0 Contrib., but can not see any dll by that name under the bin.
Any help is appreciated
Thanks
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.1913 / Virus Database: 2112/4799 - Release Date: 02/09/12
Hi MFCI,
I forgot to mention. Although the MAB can be used in isolation with any DataSet-based data scheme, it was specifically designed to work in conjunction with the QAB which deals with getting data from just about any data source (DB, web Service or XML etc) and converting to a dataset which is then manipulated by the MAB into a custom object. I have used this extensively in all of my projects to great effect. Tip: build your custom objects first, mark them with the appropriate “Mapper” and “Map” attributes and then use the MAB generator to generate all your mapping configuration automatically, It saves a whole lot of time.
Cheers… ewdev
From: MFCI [email removed]
Sent: 10 February 2012 20:09
To: sp@ewdev.com
Subject: Mapping Application Block 4.1 [entlibcontrib:304619]
From: MFCI
Hi,
I am trying to employ this library for mapping datasource objects to custom business domain objects,
The very first problem: Can anyone point me to where I an find the related Dll files [I mean Mapping.dll...etc]
I have downloaded the 4.1 & 5.0 Contrib., but can not see any dll by that name under the bin.
Any help is appreciated
Thanks
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.1913 / Virus Database: 2112/4799 - Release Date: 02/09/12
I have written a web application that is using the Ent Lib for database interaction. The site has a component where a file is uploaded and stored in the database. At the moment that is a SQL Server database. I can do this using SQL Server objects based on over examples but the EntLibContrib library can't replicate the same functionality. Specifically there is an issue where the Object type defaults to a "sql_variant" type in the base objects and this type does not support more than 8000 bytes. The result is the following error:
Parameter '@DocFile' exceeds the size limit for the sql_variant datatype.
Does anyone know of a way to store documents in SQL Server using the enterprise library?
I should note that I am using version 4.1 for Oracle compatibility reasons.
After making use of the Entlib Contrib - having some of the DLL versions increased from 5.0.414.0 to 5.0.505.0, has anyone had problems? I've updated app.config files to reflect these DLL version changes, but the Microsoft.Practices.EnterpriseLibrary.ExceptionHandling gives me problems. I posted a discussion over on the entlib forum.
Check the thread on the entlib forum for more details on how to fix the issue.
Cheers,
Jeremi
Hi,
sorry for taking so long. Do you still experience the issue? I would however need more details about your actual setup.
Are you targeting SQL Server or Oracle? If your targeting SQL Server, then I would recommend you to post this thread on the EntLib forum since EntLibContrib is specific to other data providers such as Oracle, MySql, etc.
But at first sight, I would try to explicitly specify the DbType when creating the parameters. Also make sure you're using the right type at the database level (most SQL Server "var" types have a maximum length of 8016 bytes).
Regards,
Jeremi
Hi and thanks for the reply Jeremi,
It is SQL Server that I am trying to work with but I was hoping for a solution that would be platform independent. In the end I used the SQL client object directly since I could not get the DBType to work. Basically there is no varbinary equivalent that I could make out.
Thanks,
Peter
Hi Peter,
indeed, you have to use the Sql client object directly and specify the SqlDbType since DbType.Object is mapped to SqlDbType.Variant as described here http://msdn.microsoft.com/en-us/library/yy6y35y8.aspx.
Cheers,
Jeremi
From: jbourgault
Hi Peter,
indeed, you have to use the Sql client object directly and specify the SqlDbType since DbType.Object is mapped to SqlDbType.Variant as described herehttp://msdn.microsoft.com/en-us/library/yy6y35y8.aspx.
Cheers,
Jeremi
+1 vote for RAB
DoExecuteReader method of Microsoft.Practises.EnterpriseLibrary.Data.Database.cs class is throwing exception
""Failed to convert parameter value from a SqlParameter to a String."
Here is the stack trace
at System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType)
at System.Data.SqlClient.SqlParameter.GetCoercedValue()
at System.Data.SqlClient.SqlParameter.Validate(Int32 index, Boolean isCommandProc)
at System.Data.SqlClient.SqlCommand.SetUpRPCParameters(_SqlRPC rpc, Int32 startCount, Boolean inSchema, SqlParameterCollection parameters)
at System.Data.SqlClient.SqlCommand.BuildRPC(Boolean inSchema, SqlParameterCollection parameters, _SqlRPC& rpc)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at Microsoft.Practices.EnterpriseLibrary.Data.Database.DoExecuteReader(DbCommand command, CommandBehavior cmdBehavior) in C:\Users\Ajay_Thakur01\Desktop\entlib-90009\Blocks\Data\Src\Data\Database.cs:line 453
Here is the peace of code
public
void
GetUserInformation()
{
SqlParameter[] arr_objSqlParam = new SqlParameter
[3];
IDataReader sdrUserInfo = null
;
//UserEntity objUser = null;
int
intUserId = 0;
string strMailId = null;
string strUserName = null;
string strUserRole = null;
int intCycleOpen = 0;
bool blnDefaultPassword = false
;
int
intLocked = 0;
bool blnNominationId = false
;
string strSql = "spISFGetUserInformation"
;
arr_objSqlParam[0] =
new System.Data.SqlClient.SqlParameter("@txtMailId", DbType
.String);
arr_objSqlParam[0].Value =
"abc@gmail.com"
;
arr_objSqlParam[1] =
new System.Data.SqlClient.SqlParameter("@txtPassword", DbType
.String);
arr_objSqlParam[1].Value =
""
;
arr_objSqlParam[2] =
new SqlParameter("@intCycleId", DbType
.Int32);
arr_objSqlParam[2].Value = 13;
Microsoft.Practices.EnterpriseLibrary.Data.
Database db = DatabaseFactory.CreateDatabase("MyConnection"
);
// Process results
sdrUserInfo = db.ExecuteReader(
"dbo."
+strSql, arr_objSqlParam);
// sdrUserInfo = SqlHelper.ExecuteReader(ISFConn(), CommandType.StoredProcedure, MainDBOwner() & strSql, arr_objSqlParam)
while
(sdrUserInfo.Read())
{
intUserId = sdrUserInfo.GetInt32(0);
strUserRole = sdrUserInfo.GetString(1);
intCycleOpen = sdrUserInfo.GetInt32(2);
blnDefaultPassword = sdrUserInfo.GetBoolean(3);
intLocked = sdrUserInfo.GetInt32(4);
strUserName = sdrUserInfo.GetString(5);
blnNominationId = sdrUserInfo.GetBoolean(6);
}
The innner exception is {"Object must implement IConvertible."}