Can't add SD.LLBLGen.Pro.ORMSupportClasses.Web components to VS2017

Posts   
 
    
Aziztech
User
Posts: 11
Joined: 07-Jan-2019
# Posted on: 07-Jan-2019 12:50:57   

I've web project and connected Llblgen 5.3 database. I want to add LLBLGenProDataSource2 to my web page but there is no such in toolbox. I've tried to add it through "Choose items..." but it gives error There are no components in SD.LLBLGen.Pro.ORMSupportClasses.Web that can be placed on the toolbox https://i.stack.imgur.com/x7xjj.png

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 07-Jan-2019 12:56:08   

You have a webforms page open in design mode in 2017?

Frans Bouma | Lead developer LLBLGen Pro
Aziztech
User
Posts: 11
Joined: 07-Jan-2019
# Posted on: 07-Jan-2019 13:04:40   

yes. _Default : Page

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 07-Jan-2019 13:10:29   

And you have referenced the SD.LLBLGen.Pro.ORMSupportClasses.web in the project? Thing is, if I have a reference to that dll in my project (either through nuget or directly), the toolbox adds the components automatically. (I have them added to the toolbox, and I didn't do anything. VS 2017 latest). Also make sure your project targets .NET 4.5.2 or higher.

Frans Bouma | Lead developer LLBLGen Pro
Aziztech
User
Posts: 11
Joined: 07-Jan-2019
# Posted on: 07-Jan-2019 13:15:14   

yes SD.LLBLGen.Pro.ORMSupportClasses.web is referenced. VS version 2017 15.9. my project targets .Net 4.6

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 07-Jan-2019 14:31:20   

It works with 5.4.x and 5.5.x but not v5.3.x. I can reproduce it with the 5.3.2 version pulled from nuget, it indeed says it can't find any components. When I have v5.4 (or v5.5) installed however, the toolbox finds the dlls automatically on-disk and adds the toolbox items.

I guess it's a .net issue as the .web dll of 5.3.2 was build against .net 3.5 and 5.4 was build against .net 4.5.2.

So I'm afraid you have to use the xml / html tags instead and not the toolbox. At the top of your page, add:

<%@ Register TagPrefix="llblgenpro" Namespace="SD.LLBLGen.Pro.ORMSupportClasses" Assembly="SD.LLBLGen.Pro.ORMSupportClasses.Web, Version=5.3.0.0, Culture=neutral, PublicKeyToken=ca73b74ba4e3ff27" %>

Then somewhere on your page do:

<llblgenpro:LLBLGenProDataSource2 ID="myDS" runat="server" CacheLocation="Session" DataContainerType="EntityCollection" EnablePaging="True"/>

and when you switch to 'Design' view you'll see the datasource, you can now config it using the UI if you want to.

Frans Bouma | Lead developer LLBLGen Pro
Aziztech
User
Posts: 11
Joined: 07-Jan-2019
# Posted on: 08-Jan-2019 04:52:16   

I've added the tags manually but in Design view it gives error error creating control unable to create type could not find file or assembly or of it's dependencies.

Aziztech
User
Posts: 11
Joined: 07-Jan-2019
# Posted on: 08-Jan-2019 05:33:27   

i've installed the SD.LLBLGen.Pro.ORMSupportClasses.Web to GAC and restarted the VS the error changed to "Attempt by security transparent method SD.LLBLGen.Pro.ORMSupportClasses.LLBLGenProDataSource2..ctor() to access link demand protected method SD.LLBLGen.Pro.ORMSupportClasses.LLBLGenProDataSourceBase..ctor() failed. Methods must be security critical or safe-critical to satisfy link demand"

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 08-Jan-2019 09:07:48   

No need to add the files to the gac, that won't change anything

Aziztech wrote:

I've added the tags manually but in Design view it gives error error creating control unable to create type could not find file or assembly or of it's dependencies.

You are sure you added the other tag at the top of the page which defines where the control is located?

When you compile you get errors too? It's odd you get these errors, I had no problems yesterday with the one from nuget...

Frans Bouma | Lead developer LLBLGen Pro
Aziztech
User
Posts: 11
Joined: 07-Jan-2019
# Posted on: 08-Jan-2019 10:00:02   

Yes sure I've add the tag

<%@ Register TagPrefix="llblgenpro" Namespace="SD.LLBLGen.Pro.ORMSupportClasses" Assembly="SD.LLBLGen.Pro.ORMSupportClasses.Web, Version=5.3.0.0 , Culture=neutral, PublicKeyToken=ca73b74ba4e3ff27" %>

and as I said the error is about the Security mode of assembly. "Attempt by security transparent method SD.LLBLGen.Pro.ORMSupportClasses.LLBLGenProDataSource2..ctor() to access link demand protected method SD.LLBLGen.Pro.ORMSupportClasses.LLBLGenProDataSourceBase..ctor() failed. Methods must be security critical or safe-critical to satisfy link demand"

Attachments
Filename File size Added on Approval
About.aspx 1,740 08-Jan-2019 10:49.52 Approved
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 08-Jan-2019 11:35:51   

Hmm.

In your web.config file, could you add:

<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
  <controls>
    <add assembly="SD.LLBLGen.Pro.ORMSupportClasses.Web, Version=5.3.0.0, Culture=neutral, PublicKeyToken=ca73b74ba4e3ff27" namespace="SD.LLBLGen.Pro.ORMSupportClasses" tagPrefix="llblgenpro" />
  </controls>
</pages>

(inside system.web). There's already a <pages> tag likely, so add the attribute controlRenderingCompatibilityVersion. Otherwise I don't know what it could be... disappointed

(at least remove the dll from the gac, you don't need it there).

I added the controls through the nuget package. No toolbox support, but I could add the control just fine to the default page of a default webforms project created in vs, then switch to design view and use it.

Frans Bouma | Lead developer LLBLGen Pro
Aziztech
User
Posts: 11
Joined: 07-Jan-2019
# Posted on: 08-Jan-2019 11:54:56   

it didn't help same error.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 08-Jan-2019 12:20:32   

I've created a minimal sample, with 5.3.2 from nuget (no dal). When you open TestForm.aspx in vs, then flip to design it should work properly. You might need to restore nuget packages so use nuget restore first. Then Compile, then open TestForm.aspx. (the asp.net webforms editor otherwise won't refresh itself. That's not something we can fix).

You'll get a smart tag on the control, which gives a dialog with no entities as there's no generated code referenced (please refer to this doc page for details: https://www.llblgen.com/Documentation/5.5/LLBLGen%20Pro%20RTF/Using%20the%20generated%20code/Adapter/Databinding%20at%20designtime%20and%20runtime/gencode_databinding_adapter_aspnet2x.htm ) it also shows the html syntax if you want to write it by hand.

Attachments
Filename File size Added on Approval
WebTest2.zip 9,284 08-Jan-2019 12:25.39 Approved
Frans Bouma | Lead developer LLBLGen Pro
Aziztech
User
Posts: 11
Joined: 07-Jan-2019
# Posted on: 08-Jan-2019 12:35:17   

Same problem, seems smth wrong with VS. but good news I've updated the assemblies by nuget till 5.5 and it worked. in my project referenced to the new dll and added manually the component it worked config screen could be showed but the adapter and entityfactory list are empty

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 08-Jan-2019 13:47:32   

the generated code also has to be v5.5 of course (and use the 5.5 runtime).

The main painpoint with these controls was that visual studio didn't play nice, it was sometimes impossible to get the UI forms updated when e.g. you generated new code, recompiled even. This was also a problem with the asp.net datasource controls so I guess it's part of the underlying system that goes wrong. As it's no longer updated I guess it's not going to be fixed.

IMHO the best way to use the datasource controls is simply to write the HTML and don't bother with the GUI from the smarttag in design view. See the doc page I linked above for the syntax, it's pretty straight forward.

Frans Bouma | Lead developer LLBLGen Pro
Aziztech
User
Posts: 11
Joined: 07-Jan-2019
# Posted on: 08-Jan-2019 14:31:36   

I've added manually smth like that AdapterTypeName="SingleWindow.Data.DatabaseSpecific.DataAccessAdapter" EntityFactoryTypeName="SingleWindow.Data.FactoryClasses.ContactBankEntityFactory" but no luck it's not working

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 08-Jan-2019 14:43:00   

you have to append the assembly name with a comma, so something like:

AdapterTypeName="SingleWindow.Data.DatabaseSpecific.DataAccessAdapter, SingleWindow.Data.DatabaseSpecific"

and also for the factory type name. So right-click the dbspecific project in vs, properties -> application tab and use the name under 'assembly name'.

It's silly, but otherwise .net can't load the type.

Frans Bouma | Lead developer LLBLGen Pro
Aziztech
User
Posts: 11
Joined: 07-Jan-2019
# Posted on: 08-Jan-2019 14:55:11   

I corrected the names and it worked in runtime but not in design-time without design-time binding it seems to be useless in that way, equal to fetch the entitycollection in code and bind it to grid in run-time

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 08-Jan-2019 15:20:11   

What does 'not in design time' mean, exactly? It might very well be you run into the limitations of the datasource controls as I described above, which is something we can't fix (as it's in vs). Tried reopening the project in vs? I know that sounds stupid, but really it's one of the ways to get it corrected as in: to get the vs webforms designer to reinitialize its controls... disappointed

Frans Bouma | Lead developer LLBLGen Pro
Aziztech
User
Posts: 11
Joined: 07-Jan-2019
# Posted on: 11-Jan-2019 06:51:57   

I forgot to mention that my project is for x64 platform, I realized that when I switch to x86 the llblgen data source starts working. Is there such limitation exist there?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 11-Jan-2019 09:00:26   

That shouldn't make a difference. My test project was set to 'AnyCPU'. vs is 32bit but the control lib is anyCPU built...

It might very well be because you changed anything vs loaded the page again and initialized things properly and it started working. Like I said, the whole datasource design system of asp.net webforms isn't the most stable software ever written and we can't fix that, sadly.

Frans Bouma | Lead developer LLBLGen Pro