extending an existing app that was built with sprocs

Posts   
 
    
yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 16-Jun-2006 11:45:42   

hiya, I'm looking at the commerce starterkit 2.0 The DAL uses sprocs.

Is anyone else trying to port this over to llblgen? I understand that I can convert the sprocss to views, then create entities via the llblgen designer.

However, how would extend the functionality in the app? At the moment, I think I'd have to monkey with the view sql, then re-generate the code.

AmI correct?Surely I should be able to extend the app by modifying the schema, then re-generating..thereby avoiding the neeed to manually create T sql?

Many thanks,

yogi

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 16-Jun-2006 15:06:57   

I think the following thread was discussing the same or a related issue: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=5353

yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 19-Jun-2006 10:37:49   

hiya, No, the post that you refer concerns a different issue.

ok, my scenario,

I have a sproc. I create a typed view I generate an llblGen entity via the designer.

I now want to extnd this entity.

Do I ditch the sproc and now work with the entity, or do I have to delve into the TSQL?

cheers,

yogi

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 19-Jun-2006 15:33:12   

I have a sproc. I create a typed view I generate an llblGen entity via the designer.

Why do you take this approach? it's better to directly map the entities on the tables, as views are for read-only purposes. Use views only for complex queries (selects).

Otherwise you can do everything by the code. That's what the O/R mapper is about, so that you can drop the sprocs and the TSQL stuff.

I now want to extnd this entity.

What exactly do you mean? how do you want to exted the entity?

yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 19-Jun-2006 16:45:21   

Why do you take this approach? it's better to directly map the entities on the tables, as views are for read-only purposes. Use views only for complex queries (selects).

I only had a sproc to work with ( a fairly complicated sproc).That is why I used a typed view to generate the entity.

If you had a complicated sproc as a starting point, what approach would you take? Of course I want to avoid the TSQL stuff, that is why I asked the question.

ta,

yogi

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 20-Jun-2006 08:16:09   

If you had a complicated sproc as a starting point, what approach would you take?

What does the sproc do?

Does it read data from the database without taking parameters? Why do you need data to be read from the sproc into an entity? not a dataTable?

You may add a sproc call from LLBLGen Pro, you may also have it in a database view and map the view a typedView, and also you can map the view to an entity, if you want it to have relations with other entities.

yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 20-Jun-2006 10:22:11   

What does the sproc do?

Hiya, below is the sproc. I use this sproc to generate the typed view-->entity.

The issue is that I don't know how to represent "HAVING" clauses and "UDF's" in Llbegenpro.

cheers,

yogi


SELECT   TOP 5 
table1.field1, 
table1.field2,

table2.field1, 
table2.field2,
(SELECT  TOP 1 imageFile
FROM         CSK_Store_Image
WHERE    (productID = table2.field2)) AS ImageFile

FROM ...a few INNER JOINS

WHERE

....a UDF etc

GROUP BY
HAVING

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 20-Jun-2006 15:22:03   

The issue is that I don't know how to represent "HAVING" clauses and "UDF's" in Llbegenpro.

If you are going to have this query in a sproc, then you won't need to call any UDF from the code, nor will you need to represent the having clause.

I always use database views for complex quries, and I most often map those views to TypedViews, unless I want to use a relation between a view and another entity, in this case I map it to an Entity

yogiberr
User
Posts: 432
Joined: 29-Jun-2005
# Posted on: 23-Jun-2006 12:31:49   

Thanks Walaa.

I think I understand...If I wanted to filter the data, I would I simply use predicates on the entity, instead of "HAVING" clauses within the sproc, thereby freeing me from having to write T-SQL.

ta,

yogi