DependancyInjectionInformation problem

Posts   
 
    
quentinjs avatar
quentinjs
User
Posts: 110
Joined: 09-Oct-2009
# Posted on: 01-Nov-2009 06:35:46   

In the web.config I have the following:

<configuration>
    <configSections>
    <!-- ENABLING DEPENDENCY INJECTION
        For more info read "LLBLGenPro Help - Depedency Injection mechanism"
    -->
    <section name="dependencyInjectionInformation" type="SD.LLBLGen.Pro.ORMSupportClasses.DependencyInjectionSectionHandler, SD.LLBLGen.Pro.ORMSupportClasses.NET20, Version=2.5.0.0, Culture=neutral, PublicKeyToken=ca73b74ba4e3ff27"/>
    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
            <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                    <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
                    <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                    <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                    <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
                </sectionGroup>
            </sectionGroup>
        </sectionGroup>
    </configSections>

  <!-- SPECIFYING DI INFORMATION
    Comment/Uncomment assemblies to enabled/disabled Auditors injected to your EntityClasses
    For more info read "LLBLGenPro Help - Depedency Injection mechanism" -->
  <dependencyInjectionInformation>
    <additionalAssemblies>
      <assembly filename="Glossary.Validators.dll"/>
      <assembly filename="Glossary.DatabaseAuditor.dll"/>
    </additionalAssemblies>
  </dependencyInjectionInformation>

Using Studio 2008 .net 3.5

Not sure what happened, but this was working fine, now I get errors complaing that:

Message 1 Could not find schema information for the element 'dependencyInjectionInformation'. C:\Projects\glossary-mvc\glossary-mvc\Web.config 32 4 glossary-mvc

Any ideas how to trouble shoot this ?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 01-Nov-2009 11:05:50   

not sure why you have 2.5.0.0 as version for the ormsupport classes, you're using the 2.6 demo?

change 2.5.0.0 into 2.6.0.0

Frans Bouma | Lead developer LLBLGen Pro
quentinjs avatar
quentinjs
User
Posts: 110
Joined: 09-Oct-2009
# Posted on: 01-Nov-2009 21:49:17   

Otis wrote:

not sure why you have 2.5.0.0 as version for the ormsupport classes, you're using the 2.6 demo?

change 2.5.0.0 into 2.6.0.0

In that case you best go through the example apps and just to be sure the help file to upgrade them to 2.6. I think I copied it from the example app.

And just changed it from 2.5 to 2.6 and still doesn't work. Same problem. If I comment out all the

    
      <assembly filename="Glossary.Validators.dll"/>
      <assembly filename="Glossary.DatabaseAuditors.dll"/>

Then the web config doesn't complain.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 02-Nov-2009 10:39:39   

It seems that you are not the only facing this issue. Googling around showed many people in the same boat.

e.g. http://fgheysels.blogspot.com/2006/02/problem-with-custom-configsections-in.html http://forums.asp.net/p/1078424/1598583.aspx

btw, this is not an error nor a warning, dos your application work correctly if you ignore the message? i.e. does DI work?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 02-Nov-2009 17:41:58   

(about 2.5.0.0 vs. 2.6.0.0: we'll look into that)

Frans Bouma | Lead developer LLBLGen Pro
quentinjs avatar
quentinjs
User
Posts: 110
Joined: 09-Oct-2009
# Posted on: 02-Nov-2009 17:58:57   

I noticed others having this problem as well. FYI the example app had same problem so its not something I mangled in my application.

I decided to try repairing or reinstalling studio, and its decided to not want to. I may have to manually uninstall studio, which I doubt is a fun task.

But that's outside the scope of this forum.

quentinjs avatar
quentinjs
User
Posts: 110
Joined: 09-Oct-2009
# Posted on: 03-Nov-2009 02:45:02   
  1. Repairing didn't help.
  2. If I understand correctly the error is not a problem on its own, its just a custom LLBL configuration section.

Questions 1. Is there an XSD from LLBL for Dependancy Injection? 2. I still get the following error, suggestions ?

The type 'glossaryDB.EntityClasses.GroupEntity' exists in both 'c:\Projects\glossary-mvc\glossary.Validators\bin\Debug\Glossary.Validators.dll' and 'c:\Projects\glossary-mvc\glossary.DB\bin\Debug\glossaryDB.dll' C:\Projects\glossary-mvc\glossary-mvc\Controllers\GroupController.cs

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 03-Nov-2009 12:42:28   

why GroupEntity is declared in Glossary.Validators.dll ?

quentinjs avatar
quentinjs
User
Posts: 110
Joined: 09-Oct-2009
# Posted on: 03-Nov-2009 18:14:25   

Hopefully this is a learning post for me... and perhaps others.

I've looked into the "Validator" and its mentioned its a property.

I found another example

[DependencyInjectionInfo(typeof(EmployeeEntity), "AuthorizerToUse", 
    ContextType = DependencyInjectionContextType.Singleton)]

And in this its "AuthorizerToUse" - in all examples I've seen, this property doesn't seem to be used, is there a special way that its being used?

What confused me further is the validation example you have on the web site.

The example uses:

namespace  SD.LLBLGen.Pro.Examples.Validators
and [DependencyInjectionInfo(typeof(OrderEntity), "Validator")]

and in that example, I didn't see any reference to "Validator" either. Then what confuses me further is in the config file within the dependencyinjection section:

<assembly filename="SD.LLBLGen.Pro.Examples.[b]Validation.[/b]Validators.dll"/>

This is not part of the name space, and doesn't match the "Validator" property either. So is this a problem in the example program? Or a problem in my understanding?


  • all the generated LLBL data is in glossaryDB
  • all the validators are in glossary.Validators
  • using dependancy injection.

So I have a partial class

namespace glossary.Validators
{
    [DependencyInjectionInfo(typeof(GroupEntity), "Validator")]

 .
 .
 .
}

otherwise my class is the same as this example as I copied it and made changes.
In the config file I used:

<assembly filename="Glossary.Validators.dll"/>

is this case sensitive?

Then in my main solution to make them all happy I need to fully qualify them, which in the example solution is not necessary.
So I need to say

glossaryDB.EntityClasses.GroupEntity e_group = new glossaryDB.EntityClasses.GroupEntity();

Thoughts?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 04-Nov-2009 03:02:43   

quentinjs wrote:

I've looked into the "Validator" and its mentioned its a property.

I found another example

[DependencyInjectionInfo(typeof(EmployeeEntity), "AuthorizerToUse", 
    ContextType = DependencyInjectionContextType.Singleton)]

And in this its "AuthorizerToUse" - in all examples I've seen, this property doesn't seem to be used, is there a special way that its being used?

That is for Authorization.

quentinjs wrote:

What confused me further is the validation example you have on the web site.

The example uses:

namespace  SD.LLBLGen.Pro.Examples.Validators
and [DependencyInjectionInfo(typeof(OrderEntity), "Validator")]

and in that example, I didn't see any reference to "Validator" either.

Ok. I will explain a little bit this:

namespace  SD.LLBLGen.Pro.Examples.Validators

This is just the namespace under which we write the OrderValidator.

[DependencyInjectionInfo(typeof(OrderEntity), "Validator")]

This means: inject this **OrderValidator **on the property Validator of the **OrderEntity **instances. So, "Validator" is the name of the entity property that represents the validator that will be used.

quentinjs wrote:

Then what confuses me further is in the config file within the dependencyinjection section:

<assembly filename="SD.LLBLGen.Pro.Examples.[b]Validation.[/b]Validators.dll"/>

This is not part of the name space, and doesn't match the "Validator" property either. So is this a problem in the example program? Or a problem in my understanding?

That line represents the name of the assembly where the validator classes reside. If you right-click on the SD.LLBLGen.Pro.Examples.Validators project and click Properties you will see that that line corresponds to the assembly file name.

quentinjs wrote:

So I have a partial class

namespace glossary.Validators
{
    [DependencyInjectionInfo(typeof(GroupEntity), "Validator")]

 .
 .
 .
}

otherwise my class is the same as this example as I copied it and made changes.
In the config file I used:

<assembly filename="Glossary.Validators.dll"/>

is this case sensitive?

What is the exact name of the assembly. Look at the project properties of the project where those validators reside.

At first I didn't understand you (your first post). Do you have problems with validator or auditor. I think it's auditors right? Now seems like your real problem is that the assemblies didn't get loaded.

(Edit) I downloaded and tested the Validator example and it works as expected.

David Elizondo | LLBLGen Support Team
quentinjs avatar
quentinjs
User
Posts: 110
Joined: 09-Oct-2009
# Posted on: 04-Nov-2009 06:30:44   

My first message still confuses me.

How does the example application know which is the right namespace to find the partial. I found that I have to fully qualify all EntityClasses so that the compiler doesn't complain and will choose glossaryDB.EntityClasses.GroupEnity.

Okay so I had some name spaces that were messed up. Now the assembly in the properties, the name space in the properties, the namespace in the files and the solution all have the same name for each. (hope this simplifies my confusion). This didn't help my original problem as removing the fully quallified makes it complain again.

So why in one class its called "Validator" and in another its "AuthorizerToUse" for consistency you may want to consider calling the second one "Authorizer".

But back to my woes...


'glossaryDB.EntityClasses.UserAccountEntity' does not contain a definition for 'IsValid' and the best extension method overload 'Glossary.Validators.ExtensionMethods.IsValid(Glossary.Validators.IValidatedModel)' has some invalid arguments

Would this be because the assemblies aren't loading? Or how do I know the assemblies are being loaded? (is there a test? )

and thanks for the help related to my last post, it was very helpful.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 04-Nov-2009 11:43:12   

So why in one class its called "Validator" and in another its "AuthorizerToUse" for consistency you may want to consider calling the second one "Authorizer".

These are not defined in different classes. An OrderEntity instance will have the following member variables (properties): - Validator - AuthorizerToUse - AuditorToUse Please check the reference manualfor the EntityBase class.

Maybe these weren't the best naming convention to use.

'glossaryDB.EntityClasses.UserAccountEntity' does not contain a definition for 'IsValid' and the best extension method overload 'Glossary.Validators.ExtensionMethods.IsValid(Glossary.Validators.IValidatedModel)' has some invalid arguments

Where does "IsValid" come from? Do you have a field of some entity called IsValid?

Did you download the Validation example, Authorization Example or Auditing Example and test it?

Did you check the Assembly Name of your Validator (VS -> Project Properties)?

quentinjs avatar
quentinjs
User
Posts: 110
Joined: 09-Oct-2009
# Posted on: 04-Nov-2009 14:19:13   

So you were correct, my problem was name spaces and that the .config xsd is mangled, which threw me on a wild goose chase.

I compounded my headaches by refactoring all my projects into 3 additional ones, like glossary.Validation. Unfortunately I also moved all my DataAnnotations ivalidation classes into same project and alas they need to be in the DB project.

Now only one problem left to solve, probably related to all this moving around.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 04-Nov-2009 15:33:14   

Glad you are controling things simple_smile

quentinjs avatar
quentinjs
User
Posts: 110
Joined: 09-Oct-2009
# Posted on: 03-Sep-2010 18:40:58   

quentinjs wrote:

So you were correct, my problem was name spaces and that the .config xsd is mangled, which threw me on a wild goose chase.

I compounded my headaches by refactoring all my projects into 3 additional ones, like glossary.Validation. Unfortunately I also moved all my DataAnnotations ivalidation classes into same project and alas they need to be in the DB project.

Now only one problem left to solve, probably related to all this moving around.

I wish I new exactly what I changed a year ago... I should have elaborated more in my final post.