MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

LINQ & LLBLGEN Pro?  (Mono Support )

Viewed 13951 time(s), 6 post(s) 2/23/2012 10:27:02 AMby qurban
qurban

qurban

2/23/2012 10:27:02 AM
Hi,

1- In the documentation it is mentioned that LLBLGEN Pro is used for the DAL. Which version is used of LLBLGEN? What was the framework? v1, v4, LINQ TO SQL, Runtime Framework or NHibernate? It is important to mention even in the documentation as if anyone want to modify the existing web parts, all these information are very important?

2- It is mentioned in the documentation that LINQ can be used? The syntax of LINQ and LLBLGEN is different? If we create LINQ to SQL code from LLBLGEN, wouldn't it be LINQ Code?

3- If i create seperate project for the sake of creating new web part using LINQ. What files will go to repositories folder and what files will go to BusinessLayer folder?

thanks

Qurban
This content has not been rated yet. 
203 Reputation 15 Total posts
khorvat

khorvat

2/24/2012 7:59:16 AM
Hi,

to answer your questions

1- In the documentation it is mentioned that LLBLGEN Pro is used for the DAL. Which version is used of LLBLGEN? What was the framework? v1, v4, LINQ TO SQL, Runtime Framework or NHibernate? It is important to mention even in the documentation as if anyone want to modify the existing web parts, all these information are very important?

Documentation was written in the period when LLBLGen 2.6 was the latest version and now MonoX is using LLBLGen 3.1 which has a bit different concept (from the visual designer point of view) so we will update the MonoX documentation in next release. So LLBLGen 3.1 is used in Adapter mode with LLBLGen Framework compiled for .NET 4.0.

2- It is mentioned in the documentation that LINQ can be used? The syntax of LINQ and LLBLGEN is different? If we create LINQ to SQL code from LLBLGEN, wouldn't it be LINQ Code?
LLBLGen to Linq concept is the same, the only thing that you need to do is to create the DataAccessAdapter and LinqMetaData from there on you have strongly typed data objects and pure LINQ e.g.
using(DataAccessAdapter adapter = new DataAccessAdapter())
{
    LinqMetaData metaData = new LinqMetaData(adapter);
    var q = from c in metaData.Customer
            where c.Country=="USA"
            select c;
 
    // enumerate over q here so it gets executed
}

Please take a look at the following articles
Generated code - Linq to LLBLGen Pro, getting started
Generated code - Linq to LLBLGen Pro, Prefetch paths
Developing Linq to LLBLGen Pro, part 1 (Series of LLBLGen to LINQ articles)

3- If i create seperate project for the sake of creating new web part using LINQ. What files will go to repositories folder and what files will go to BusinessLayer folder?
Please take a look at the following articles to see the above patterns (Note: there are many articles describing the Repository and BLL patterns)
The Repository Pattern
Business Layer Guidelines

Let us know if you need anything else.

Regards
Rated 5.00, 1 vote(s). 
15993 Reputation 2214 Total posts
qurban

qurban

2/24/2012 9:55:40 AM
Many thanks. Very helpful.
This content has not been rated yet. 
203 Reputation 15 Total posts
shawndg

shawndg

2/24/2012 11:37:24 PM
I actually created a whole other project just to handle my linqs..

I then used my own manager classes DLL that where link query functions and then I ref the dll in the primary

I then passed the same data connection string from the webconfig into my dll.

I got it setup something like this..

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TheScene.DataManager.Lists
{
public partial class ListManager
{

public string ConnectionString { get; set; }

public System.Linq.IQueryable GetListGenre()
{
ListData.LinqsDB db = new ListData.LinqsDB(ConnectionString);

var Genre = from p in db.MusicGenres
select p;

return Genre;
}

}
}

I then turn that into a dll and add the ref into my primary MonoX project.

I then can add some code into any place i need something like this..

//List Function - List, Find, etc..
using TheScene.DataManager.Lists;

//Load List of Band Genres
ListManager MyListManager = new ListManager();
MyListManager.ConnectionString = MonoSoftware.MonoX.ApplicationSettings.LocalSqlServer;


DropGenre.DataSource = MyListManager.GetListGenre();
DropGenre.DataTextField = "GenreListName";
DropGenre.DataValueField = "GenreId";
DropGenre.DataBind();

This content has not been rated yet. 
1871 Reputation 252 Total posts
khorvat

khorvat

2/25/2012 9:08:51 AM
@Shawndg - Nice approach, so did you actually created a separate "Repository Layer" in your custom library and is it only used with LINQ to SQL and MonoX data model ?

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
shawndg

shawndg

2/25/2012 1:36:42 PM
Hi khorvat,

Ya I pretty much have a couple core classes I call the managers and they expose my linqs class to MonoX..

The classes are just linqs database access and verifications to check to see if the code executed or not.
I have some more advanced stuff of course like selecting records by ids, etc.. and returning rows and items.

I call the managers all through my custom web parts but primary only to edit my own custom database ext table which are build off of MonoX and have unofficial key relations that join with MonoX ids to store extra data specific to my project.

Now I do have a couple of issues like right now if you delete a user using the standard MonoX admin interface then it will only delete some of the data.
I can solve this by adding a trigger to the table in SQL or some other method I just have not played with it yet.

The last thing I want to do though is modify core MonoX tables so I keep all my stuff separate so that upgrades don't mess up my database structure.

I would like to learn a little more about the LLBLGen so I will likely check out your links for things like overriding existing MonoX webparts although I could prob use linqs here as well I am sure.


This content has not been rated yet. 
1871 Reputation 252 Total posts