473,395 Members | 1,502 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Object store/Database and LINQ

Hi all,

I'm storing all kind of data stored in objects. Now I want to query my
data-source. And I thought LINQ is the right thing for it.

Data is stored like:

store.Database["%Testtable%"][%RowID%]["%Fieldname%"]

Queries like this work:

var q = from row store.Database["%Testtable%"].Rows
where row.ID == 10
select new { Id = row.ID, Label = row["Label"] };

I want to query my data with a XML-syntax, like:

<data>
<query>
<table name="Testtable" alias="t" />
<table name="Testtable_2" alias="t2" innerjoin="t.ID == t2.ID" />
<where condition="t.ID == 10" />
<field table="t" name="ID" alias="Id" />
<field table="t" name="Label" alias="Label" />
<field table="t2" name="Label" alias="Label" />
</query>
</data>

Do you think this is possible? To parse this XML to a working LINQ-
query? I've tried lots of things, but I cannot get it to work! :S

Hopefully someone can help me. Or if you could suggest me an
alternative, I will think about this too.

Thanks.
Jelle
Nov 11 '08 #1
2 3278
je*****@gmail.com wrote:
<data>
<query>
<table name="Testtable" alias="t" />
<table name="Testtable_2" alias="t2" innerjoin="t.ID == t2.ID" />
<where condition="t.ID == 10" />
<field table="t" name="ID" alias="Id" />
<field table="t" name="Label" alias="Label" />
<field table="t2" name="Label" alias="Label" />
</query>
</data>

Do you think this is possible? To parse this XML to a working LINQ-
query? I've tried lots of things, but I cannot get it to work! :S

Hopefully someone can help me. Or if you could suggest me an
alternative, I will think about this too.
Sure it's possible, what you are asking to do is called a transform,
and you should be able to transform well formed Xml to whatever output
makes sense for you (including Linq statements)

There are a number of transform implementations, and in fact Linq to
XML is regarded as having transform support, the most common transform
implementation is XSLT but I don't think that it would work very well
for you for this (I may be wrong on that though, I am not very familiar
with XSLT functionality), I would be inclined to use Linq to XML.

Note given that what you will be constructing is declarative query
language statements, you may want to investigate compiler writing
techniques (lexical analysis in particular) In fact even just as an
intellectual exercise its very good to understand how this works, I
would recommend the "Purple Dragon Book" for that.
http://www.amazon.com/gp/product/0321486811/

Regards Tim.
Nov 11 '08 #2
I'm sorry, but I think you misunderstood me. I know how to transform
something with XSLT. What I want is to create a processor programm.
This programm will read a XML file like mentioned above. And it will
perform this LINQ-query and give me the outcome.

Is such a thing possible? I've been reading about the Linq.Expression
class...

Thanks.
Nov 11 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Ville Vainio | last post by:
Pythonic Nirvana - towards a true Object Oriented Environment ============================================================= IPython (by Francois Pinard) recently (next release - changes are...
8
by: Lance | last post by:
I've been teaching myself C# for a few months now and I have a concept problem. I know how to instantiate an object from a class I’ve created, but now I want to retrieve and store data in a...
15
by: mr.peteryu | last post by:
Hi, Can someone explain the idea behind casting to an interface? For example: -> I have an IInterface that contains a Read() method. -> I have an object "obj" that implements IInterface. ...
0
by: fiona | last post by:
Reading, Berkshire, UK 05 June 2007 - Crainiate Software make details available of the release of Objecto Framework 2.0, an upgrade to their enterprise business component framework, designed to...
3
by: plonk | last post by:
Hi I'm trying to learn sql by getting a database up and running on VB.net 2008 and SQL server express. I have the database connected correctly, (i think) but when i try to add a record using this...
5
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
After having played around with LINQ and reading the literature on it I have not been successful in getting this to work so I am looking for some guidance: I want to find a hunk in a collection...
2
by: Neil Chambers | last post by:
All, I have a class describing various actions to take against a LINQ to SQL datasource. What are the pros/cons of instantiating the LINQ object either in the root of the class (for lack of a...
16
by: William Gill | last post by:
I am writing some new editing pages for a db using php. I want to use an object approach for the underlying MySQL tables, and the edit page will display related data from several tables. I am...
1
by: markla | last post by:
Hi, I have an Entity data model built in Entity Framework, which sources data primarily from an MS SQL 2008 database, and sources some static (data dictionary) values from code-based objects. I...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.