Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TA (TableAdapter) question
Message
From
02/06/2009 02:40:28
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Environment versions
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01402465
Message ID:
01403107
Views:
80
>That is a pointless question. With that mindset we would be doing in assembly or K&R C today.
>
>My question is absolutely on point - the reason we don't use assembly today is because there are tools that make us more productive. You won't find too many serious database developers who feel that Linq to SQL provides more value than what they previously had. (Linq to Objects, Linq to XML is a different story)

And using Linq I am more productive in SQL provided it is .Net. You can read blogs starting with mine and maybe read much better ones like Joe Albahari, Scott Gu, Paolo Pialorsi ... I don't base my choice on the count of how many I can find. I wouldn't find too many developers woking with F# and Oslo either but I do. Linq to SQL is not L2O, L2X ... but is a big subset of it and surely it provides a uniform model on working with sequences. I think you also think L2E, Plinq, L2SP, L2AD ... are unnecessary because you can do what they are doing without Linq too:) You are saying it doesn't provide value? OK here is a very very basic one. You remember you published some code that would do paging? In L2S paging would be extremely easy:
IEnumerable<Orders> page = db.Orders
    .OrderBy( o => o.OrderDate )
    .Skip( pageIndex * pageSize )
    .Take( pageSize )
Another sample would be a question they asked on forums:

There is tickdata recorded by its time. Data structure is very basic something like:
create table tickdata (timed datetime, price money, quantity int)
insert into tickData values ('06:01',100,20)
insert into tickData values ('06:02',90,30)
insert into tickData values ('06:03',129,10)
insert into tickData values ('06:07',117,20)
insert into tickData values ('06:11',112,8)
insert into tickData values ('06:12',150,60)
insert into tickData values ('06:20',110,10)
insert into tickData values ('06:23',120,5)
insert into tickData values ('06:24:59',130,15)
insert into tickData values ('06:25',140,35)
From this data we need something like a stocks listing in 5 minutes intervals, listing should start and stop based on min-max times recorded. Something like (for the data abaove):

period,open,low,high,close,volume
06:00-06:05, 100,90,129,129,60
06:05-06:10,117,117,117,117,20
...

Think of doing it without Linq. Linq solution is a single query:
var result = 
from myData in Tickdatas.OrderBy( t => t.Timed ).AsEnumerable()
  group myData by ((int)myData.Timed.Value.TimeOfDay.TotalMinutes) / 5 into barData
  let bStart = TimeSpan.FromMinutes( barData.Key * 5 ).ToString()
  let bEnd   = TimeSpan.FromMinutes( (barData.Key+1) * 5 ).ToString()
  select new 
  { period = bStart.Substring(0,5) + " - " + bEnd.Substring(0,5),
	open   = barData.FirstOrDefault().Price,   
	low    = barData.Min( bd => bd.Price ),
	high   = barData.Max( bd => bd.Price ),
	close  = barData.LastOrDefault().Price,
	volume = barData.Sum( bd => bd.Quantity ) }
Samples are endless. Would you show me how would these be w/o Linq so I can see that L2S didn't solve anything too.

And now being on the questioning side, let me ask what breaks down, lose of functionality it causes?

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform