Please, please create some examples for LLBLGendatasource

Posts   
 
    
jovball
User
Posts: 443
Joined: 23-Jan-2005
# Posted on: 04-Sep-2006 15:13:15   

Frans:

I've read the forums enough to know that you resist the idea of working samples. Your basic concept is that it's in the documentation. However, I can't be the only one who has trouble translating the documentation into actual application usage.

I've spent the last four days experimenting with LLBLGendatasource. I can get some simple things to work but if I try anything slightly different I'm lost. The documentation isn't enough, I need some working samples that get data, insert data, update data etc. Preferably one with livepersistence and one without.

I'm going to post some specific questions but I want this request to be a thread by itself. I'm tired of banging my head against the wall. I hope some other forum readers will add to this thread.

Respectfully,

Joel Reinford Data Management Solutions LLC

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 04-Sep-2006 15:41:18   

What I found the most problematic with working with a datasourcecontrol is simply that ASP.NET + datasourcecontrol is complicated. This is because it's declarative programming. You don't write a set of code statements which execute from top to bottom and at the bottom it's done. You define a set of declararations which magically work at runtime.

Now, I could and want to create examples for you, others, not a problem with that. The problem is though: what to illustrate in the examples?

For example: with livepersistence set to true (default), there's not that much to tell, as everything is done for you. The only thing might be the select/insert/update parameters but that's ASP.NET stuff, not necessarily llblgen pro native material.

With LivePersistence set to false, it gets a bit more complicated, but not that much actually: you've to create 3 eventhandlers and that's about it, each with very straightforward code.

Most of the scenario's where things get complicated are more complicated by ASP.NET than by the datasourcecontrol, as the datasourcecontrol is just that: a datasourcecontrol: it feeds data to the bound control and handles actions sent to it by the bound control. (this thus also means that you're out of the picture: it's between the control (e.g. grid) and the datasourcecontrol).

So without a hint / info about what to illustrate in an example, I'll likely create an example like I already have created before which is too simple or illustrates the wrong things.

It might also be you're struggling with ASP.NET 2.0 (which is not a shame, it was / still is a struggle for me too) or how things interact with eachother, or how to get a tiny thing done, or just a set of questions.

Frans Bouma | Lead developer LLBLGen Pro
jovball
User
Posts: 443
Joined: 23-Jan-2005
# Posted on: 04-Sep-2006 16:47:58   

Simple examples would be better than no examples at all. The support forum is great but you're spending a lot of time answering questions that might not be asked if there were some working samples.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 04-Sep-2006 17:29:31   

jovball wrote:

Simple examples would be better than no examples at all. The support forum is great but you're spending a lot of time answering questions that might not be asked if there were some working samples.

Well, I've written an extensive article about ASP.NET and LLBLGen Pro 2.0, and have a video on the site showing how to do things. There's also a usage example in the docs, and there are examples on the forum. Though these show that they're not enough, as questions keep popping up. That's ok, the total scope of in which contexts you can use the datasource controls is simply too huge to cover it in examples alone.

What I won't do is simply create a bunch of random examples. A good argument for that is your request for an example with a formview. I gave you one, but it didn't answer your question as the example illustrated something else. I think without questions on the table like 'how to do this or that', it's IMHO impossible to provide examples which are worth it.

Though I have to add: the datasourcecontrols of llblgen pro are simply datasourcecontrols like the other ones shipped with .NET. This thus means that the docs of the 'datasourcecontrol' in the MSDN apply to the llblgen pro datasourcecontrols as well. The llblgen pro datasourcecontrols have extra features, as llblgen pro can do a lot of things. Though the set of properties to set and methods to use is rather small, as most of the power is used behind the scenes, between a bound control (grid/formview) and the datasourcecontrol.

In ASP.NET 2.0, these two work together, with the property values you setup at design time (the declarative way of programming in asp.net). This is NOT something related to llblgen pro, this is how ASP.NET 2.0 works with datasource controls.

If people aren't familiar enough with datasourcecontrols in general in combination of ASP.NET 2.0, declarative programming... it will be a tough road, but it falls outside the scope of LLBLGen pro, as it's related to core ASP.NET 2.0 material. I know it's often not that great to work with ASP.NET 2.0, I can relate to that all too well. Though what I've learned dogfooding the datasourcecontrols for our own website system is that the amount of time spend on the datasourcecontrol to get things done is minimal. Most time is spend on ASP.NET things.

So my question to you is: what are problem areas for which you want to see an example? And please understand that a generic description of what's hard, also gets a generic example which is likely not helping anybody.

Frans Bouma | Lead developer LLBLGen Pro
jovball
User
Posts: 443
Joined: 23-Jan-2005
# Posted on: 04-Sep-2006 20:04:14   

Frans:

I realize that some of the tasks are just ASP.NET and have nothing to do with LLBLGen or the LLBLGenDataSource controls. But using the generated code does not happen in a vacuum, there needs to be a context. My issue with the documentation is that the context is missing. Some examples would provide that.

I've got a couple of threads going here at the moment so I'm trying not to confuse my generic request with the specific ones.

The video is great, I'd be happy with a PDF or Word doc with text instructions and a few screenshots if those are easier to make.

My major complaint at the moment is that alsmost nothing shows how to use the
LLBLGenDataSource controls in any programmatical way. (In your blog, you showed how to set up a filter and that was helpful.) Other than digging around on the forum and finding a code samples (always out of context), there is no code that shows how use the controls when persistence = false.

OK, I've got a PerformSelect event. It's obvious I should get some data here. What should I do with the data? Do I need to bind it? That's a simple example but you don't show it anywhere that I've seen.

I'll try to come up with a list of some things you should do for samples. I'm thinking of a reference Northwind ASP.NET application so you could demonstrate all of the things that ought to be entry-level concepts.

I have not said in this thread, and need to say, that your responsiveness in the forums is incredible. That is partly why I find the lack of examples hard to understand.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 05-Sep-2006 11:27:23   

jovball wrote:

Frans:

I realize that some of the tasks are just ASP.NET and have nothing to do with LLBLGen or the LLBLGenDataSource controls. But using the generated code does not happen in a vacuum, there needs to be a context. My issue with the documentation is that the context is missing. Some examples would provide that.

You'd think that indeed simple_smile . The thing is... it's not. Well, it is but it requires a truckload of examples. For example the winforms example we have. It looks like a silly example, but it contains a lot of common constructs people run into every day. Still a lot of questions are posted which are answered by that example. My explanation for this is that people don't recognize their own situation in the example provided and thus don't make the connection with their own code.

Another thing examples do badly is teaching the 'why it is done the way it is done'. If the situation the developer has to solve is different (however it requires the same code for example), an example won't work in most cases, as the example's problem doesn't match the developer's problem.

If you look at the 'How do I? section' in the v2.0 manual, you'll see we have a lot of examples in the docs, though still people ask questions which are solved by one of these examples. That won't stop.

With ASP.NET there's another factor: it requires a truckload of ASP.NET knowledge as well. It's perhaps no surprise the # of questions about .NET on newsgroups and fora are for about 50% ASP.NET related and 50% the rest. I find that odd, especially since it's just HTML we're talking about.

The Datasourcecontrols are dumb things: they don't do things out of their own. They get a call from the bound control(s) and act upon that call: ExecuteSelect, ExecuteUpdate, ExecuteInsert and ExecuteDelete. WHEN That call comes is obscure, I don't even know when exactly. I had to find out with trial/error when which call comes (as there's no documentation on this) and when to store which data in the viewstate so filters etc. are preserved. So I'm not surprised llblgen pro users find this hard to grasp as well, as it is hard to grasp, simply because ASP.NET is so muddy. In ASP, you knew what happened when: it was in the code. Start at the top, end at the bottom. In ASP.NET this actually isn't different at all, but it LOOKS like it is and it's now unclear when what happens, unless you read the in-depth working docs of asp.net: when which event is raised and why.

The video is great, I'd be happy with a PDF or Word doc with text instructions and a few screenshots if those are easier to make.

It's not the amount of work to create a video. It's the thing that it should illustrate. Don't take this personally, but a lot of the questions which go deeper than something overlooked in the docs or a misusage of the code are actually related to the fact that the developer doesn't know how to solve the problem related to his application, not something related to LLBLGen Pro. That's OK, we're happy to help out, but it's also beyond the scope of what we can do in the example department.

So an example is then only good enough if it mimics their problem. Which is of course undoable. I also find it a waste of time for myself, our support personell and the user who reads/sits through an example video/doc if the example is too generic or doesn't illustrate something that comes up a lot. So it has to illustrate something that is truly a pain. However people often forget that LLBLGen Pro isn't VS.NET, C# or VB.NET, it's a data-access layer. It provides data-access and datamanagement functionality for your data in your app. So it doesn't solve a problem how to let a grid work together with a formview. It does solve the problem how to get the changed data back into the db.

Yes it has asp.net datasourcecontrols simply because it will make life easier to consume entities etc. in a webform. I personally HATE the datasourcecontrols, simply because they're so confusing in the whole ASP.NET context: when happens what? Can I safely set a filter in the page_load? Do I have to do that every time or is it cached in the viewstate?

For example that last question is not clear. THough it is ASP.NET stuff: you set the state of a control. On a postback that state is preserved. So if you set a filter, it is preserved. However should I answer that question in an example? Perhaps, but then where's the end, because it's actually ASP.NET stuff?

Another problem: master-detail in an ASP.NET form. Searching for it on Google gives a lot of blogposts and docs about how to solve it with an object/sqldatasource control. It isn't obvious, because asp.net doesn't have a currency manager on the form so you need 2 datasourcecontrols! With one it won't work. Confusing, yes, but ASP.NET stuff.

Two datasources and master-detail falls apart if paging is used because the indexing problem in the top grid. This is documented all over the web, though it's something you might run into and it will cost you days. It IS related to a datasourcecontrol, so people will perhaps blame the llblgen pro datasourcecontrol, as they expect it to do something it doesn't do. However... it's not its fault.

Again, I don't mind writing examples, in fact 2 big asp.net examples are planned for a while (this forum with new features complete in full source code (though not a single datasourcecontrol in sight, go figure wink and gui templates to generate a gui for asp.net, this will contain datasourcecontrol usage). The thing is though: do they illustrate what the developer with a problem is looking for? Given the limit amount of things you can set/config on the datasourcecontrol, I doubt it.

My major complaint at the moment is that alsmost nothing shows how to use the
LLBLGenDataSource controls in any programmatical way. (In your blog, you showed how to set up a filter and that was helpful.) Other than digging around on the forum and finding a code samples (always out of context), there is no code that shows how use the controls when persistence = false.

Well, an example is always out of context. Period. No matter what I do, it will be out of context.

There are 3 events, they are described in the documentation:

  • PerformSelect. This event is raised when the LLBLGenProDataSource2 control needs to retrieve data from the database.
  • PerformGetDbCount. This event is raised when the LLBLGenProDataSource2 control needs to retrieve the number of items in the complete resultset. This event is raised when server side paging is enabled and the total number of items in the resultset is required by the bound control(s).
  • PerformWork. This event is raised when ExecuteInsert/Update/Delete is called on the LLBLGenProDataSource2 control by a bound control. Typically this is done after an entity is edited in a GridView or FormView control for example, or a new entity is added through a bound control. The work is tracked in a UnitOfWork2 object which is available to you in the event arguments.

Simple and straight forward. Ok, following the link mentioned right above it, we go to intercepting activity:

As described above, the LLBLGenProDataSource2 control has various events to bind to to intercept what's going on inside the LLBLGenProDataSource2 control at runtime. For the **PerformSelect **event, the event arguments contain what the container type is, the container, and all the parameters to perform the fetch. Not all parameters of the argument are valid in every situation, for example a typedlist fetch requires a field-set but doesn't need an entity collection. The event arguments for the event **PerformGetDbCount **contain an integer called **DbCount **which should contain the determined count after the event has been handled. The event arguments for the **PerformWork **event contain a UnitOfWork2 object with the work to be performed. Typically this is a single entity, as every time the bound control updates or deletes an entity, the PerformWork event is raised, due to the postback nature of ASP.NET.

What I find strange is that this is unclear and confusing. It states explicitly: all elements needed for the event to handle are in the eventargs. It makes a special remark about the DbCount, as it has to be set.

What's the problem here is this: there's incomplete knowledge of the call chain when what happens in an asp.net page.

roughly: START -> Page init -> Grid instantiation -> Databinding setup -> Call bound datasourcecontrol's ExecuteSelect -> LivePersistence is false so raise PerformSelect, and if paging is enabled, PerformGetDbCount events -> Event handler -> your code to fetch the data -> DataSourceControl returns fetched data -> Grid consumes data and renders itself -> END

This is the same for ObjectDataSource control which calls into your own code to fetch data. As I said: an llblgen pro datasourcecontrol is a dumb thing actually: it does what it is been told to do.

However I'm not going to teach ASP.NET 2.0 and how it works. I can give more examples, however I have little hope they will add anything.

OK, I've got a PerformSelect event. It's obvious I should get some data here. What should I do with the data? Do I need to bind it? That's a simple example but you don't show it anywhere that I've seen.

I though the text was clear enough, but apparently not. Though what saddens me is that I can't find the culprit why people find something I find straight forward so confusing. Unless I find that, I can give examples but they'll likely not illustrate what the reader is looking for simply because the confusion is based on something else. My guess: the obscure nature of ASP.NET, but I find it too cheap to blame others at this point.

I'll try to come up with a list of some things you should do for samples. I'm thinking of a reference Northwind ASP.NET application so you could demonstrate all of the things that ought to be entry-level concepts.

All entrylevel concepts for ASP.NET related to LLBLGen Pro fit on 1 page, as there are very few things that might be confusing. All OTHER things are either general LLBLGen Pro constructs (e.g. how to fetch an entity collection etc. etc.) or already illustrated in our northwind app.

I have not said in this thread, and need to say, that your responsiveness in the forums is incredible. That is partly why I find the lack of examples hard to understand.

Because an example teaches the reader how to do things in the context of the example, it doesn't teach the reader why it is done that way so the reader can apply the knowledge to other situations as well.

Frans Bouma | Lead developer LLBLGen Pro
jovball
User
Posts: 443
Joined: 23-Jan-2005
# Posted on: 11-Sep-2006 16:06:25   

Frans:

I'm thinking about your answers and doing a bit more testing. I'll come back to this thread in a few days. No reply needed to this.

Joel Reinford Data Management Solutions LLC