BLINQ and Atlashttp://forums.asp.net/t/1019304.aspx/1?BLINQ+and+AtlasTue, 05 Sep 2006 21:26:42 -040010193041376436http://forums.asp.net/p/1019304/1376436.aspx/1?BLINQ+and+AtlasBLINQ and Atlas <p>Hey gang.</p> <p>I'm going to give this another shot. I really hope someone can help me out and point out where my mistake is.</p> <p>My understanding is LINQ/DLINQ and BLINQ is supposed to make querying data much simpler and using this data much simpler as well.</p> <p>So I am trying to create a webservice, of which I can use DLINQ to make a query, and use the objects BLINQ generated for easy use. My webservice code is wrong but I can't get anyone in the DLINQ forum to point out whats wrong with it.</p> <p>Any help would be greatly appreciated. </p> <p>Basically once the webservice returns a collection of objects I want to bind it to the datasource of a GridView. I believe I can do that in the Atlas OnComplete callback but I am not even at that point yet as the Webservice crashes.</p> <p>Here is the code:</p> <p>[<font color="#008080">WebMethod</font>]<br> <font color="#0000ff">public</font> <font color="#008080">Domain</font>[] Search(<font color="#0000ff">string</font> searchText)<br> {&nbsp;<br> <font color="#008080">&nbsp;&nbsp;&nbsp; MyDomains</font> db = My<font color="#008080">Domains</font>.CreateDataContext();<br> <font color="#008080">&nbsp;&nbsp;&nbsp; Domain</font>[] obj;<br> &nbsp;&nbsp;&nbsp; obj = (<font color="#0000ff">from</font> dom <font color="#0000ff">in</font> db.Domains<br> <font color="#0000ff">&nbsp;&nbsp;&nbsp; select</font> dom).ToArray&lt;<font color="#008080">Domain</font>&gt;();<br> <font color="#0000ff">&nbsp;&nbsp;&nbsp; return</font> obj;<br> }</p> <p>I don't know if I've implemented this right, but the compiler is stating:<br> <font color="#0000ff">Error&nbsp;1&nbsp;'System.Data.DLinq.Table&lt;Domain&gt;' does not contain a definition for 'ToArray'&nbsp;</font></p> <p><font color="#000000">So I believe my biggest issue is, what do I set the return type as for the webservice. Someone in DLINQ forum said ToArray but that doesn't exist. I tried list, etc but I get errors on runtime about circular references.</font></p> <p>Could anyone please help? All the BLINQ generated stuff works great but how do I add my own queries that return different data?</p> <p>I really want to build ontop of BLINQ and evaluate it as our next web platform for our company for when LINQ/DLINQ/BLINQ goes final but I've been stuck on this issue for &gt;1 week. I feel very silly as all I read is how simple things should be but obviously I have done something wrong.</p> <p>Please help me understand :)</p> <p>Thanks and take care.</p> 2006-08-21T13:44:05-04:001377444http://forums.asp.net/p/1019304/1377444.aspx/1?Re+BLINQ+and+AtlasRe: BLINQ and Atlas <p>Anyone? please? If this stuff doesn't work in the current CTP that is fine. I am trying to do something pretty common place I would think. I know I have done it wrong I just don't know where. I've tried various return types with no such luck.</p> <p>Please a little guidance where my error is would be highly appreciated.</p> <p>Thanks and take care.</p> 2006-08-22T13:30:39-04:001378973http://forums.asp.net/p/1019304/1378973.aspx/1?Re+BLINQ+and+AtlasRe: BLINQ and Atlas Ok well I am really sorry for complaining here but is this something just not possible with the current CTP? If it is not then I would rather know ahead of time instead of continiously banging my head here and wait for another CTP. 2006-08-23T18:51:51-04:001378985http://forums.asp.net/p/1019304/1378985.aspx/1?Re+BLINQ+and+AtlasRe: BLINQ and Atlas Synced, I'm sorry that I don't have any answers for you here.&nbsp; I don't know if LINQ works over a web service or whether LINQ object will serialize correctly.&nbsp; You're using 3 relatively-independent unreleased technologies together, so I would expect some hitches, but if you do get this working, please post here so others can learn from the cool stuff you're doing. 2006-08-23T19:02:32-04:001379081http://forums.asp.net/p/1019304/1379081.aspx/1?Re+BLINQ+and+AtlasRe: BLINQ and Atlas <p>Thank you so much Polita!</p> <p>I just wan't sure if this is something not known yet or just nobody fealt like responding.</p> <p>I have some questions for you which may be able to help me figure out what the issue is.</p> <p>I think my problem is the return type.</p> <p>Someone in the LINQ forum mentioned that you need to use System.Data.Extensions.dll so you can ToArray() the LINQ query and you return the array from your webservice.</p> <p>Unfortunately they are saying System.Data.Extensions.Dll does not work in website model, only in web application model.</p> <p>As far as I know BLINQ generates a project in Website model correct? I really don't know much about this stuff but if we are able to piece it together I would love to throw a blog post up somewhere about it.</p> <p>Thanks and take care!</p> 2006-08-23T20:32:36-04:001379103http://forums.asp.net/p/1019304/1379103.aspx/1?Re+BLINQ+and+AtlasRe: BLINQ and Atlas <p>This, I think I can answer!</p> <p>If the ToArray() extension method is defined in System.Data.Extensions.dll, you should be able to add that binary to your Bin folder, include it in the compiler options specified in the web.config file, add it as a &quot;using&quot; statement to your .cs file (or as an import to your .vb file), and you'll be good to go.&nbsp; Give it a try.</p> <p>I think what the LINQ team was saying is that the LINQ Web template they shipped with the May preview supports only the web app model and not the website model.&nbsp; However, since you're using a Blinq app (which uses the website model) you are not using their template.&nbsp; You should be able to make this work in your app.</p> <p>In the end, the compiler and linker don't know anything about whether it's a website or a web application.&nbsp; It's just a set of files that get compiled together to build a library.&nbsp; So if something compiles in one model, there is probably a way to make it compile in the other model.</p> 2006-08-23T20:52:32-04:001379155http://forums.asp.net/p/1019304/1379155.aspx/1?Re+BLINQ+and+AtlasRe: BLINQ and Atlas <p>Thanks Polita!</p> <p>I think this is where my experience starts to run a little thin so may need to request some of your expertise :)</p> <p>So I am assuming I need to add a similiar line to:</p> <font color="#0000ff" size="2"> <p><font size="3">&lt;</font></font><font color="#800000">add</font><font color="#0000ff"> </font><font color="#ff0000">assembly</font><font color="#0000ff">=</font>&quot;<font color="#0000ff">System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089</font>&quot;<font color="#0000ff">/&gt;</font></p> <p><font color="#0000ff" size="2"><font color="#000000" size="3">Correct? So I would make an entry with System.Data.Extensions.dll</font></font></p> <p><font color="#0000ff" size="2"><font color="#000000" size="3">I have done this, and I tried to use sn -T to find the PublicKeyToken for System.Data.Extensions.dll and it does not work.</font></font></p> <p><font color="#0000ff" size="2"><font color="#000000" size="3">So I left out the PublicKeyToken and I still get the following error on my &quot;using&quot; clause:<br> <strong>Error&nbsp;20&nbsp;The type or namespace name 'Extensions' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)&nbsp;</strong></font></font></p> <p>Any guidance would be great :)</p> <p>Thanks!<font color="#0000ff" size="2"></p> </font> 2006-08-23T22:24:50-04:001379167http://forums.asp.net/p/1019304/1379167.aspx/1?Re+BLINQ+and+AtlasRe: BLINQ and Atlas <p>It looks to me like System.Data.Extensions.dll is already in the Bin folder.</p> <p>However, I looked up the ToArray(IEnumerable&lt;T&gt;) extension method and it looks to me like it's in System.Query.dll in the System.Query namespace.&nbsp; This means all you should need is a using statement for System.Query.&nbsp; Your StaticMethods file should already have this in it.&nbsp; If you try to use this method in you StaticMethods file, does it compile and work correctly?</p> 2006-08-23T22:43:42-04:001379743http://forums.asp.net/p/1019304/1379743.aspx/1?Re+BLINQ+and+AtlasRe: BLINQ and Atlas <p>Good morning!</p> <p>Thanks so much for the help Polita. I feel like such a dumbass. Apparently I was missing System.Data in my using clause. VS wasn't giving much of a useful error to figuring this out, oh well my mistake!</p> <p>So now I am in a serialization pickle I think. The following code causes the following exception when the WebService is tested:</p> <p><font color="#3366ff"><font color="#008080">MyDomains</font><font color="#000000"> db = My</font><font color="#008080">Domains</font><font color="#000000">.CreateDataContext();<br> </font><font color="#0000ff">var</font><font color="#000000"> domains = </font><font color="#0000ff">from</font><font color="#000000"> dom </font><font color="#0000ff">in</font><font color="#000000"> db.Domains<br> </font><font color="#0000ff">select</font><font color="#000000"> dom;<br> </font><font color="#0000ff">return</font></font><font color="#000000"> domains;</font></p> <p><font color="#3366ff">System.InvalidOperationException: There was an error generating the XML document. ---&gt; System.InvalidOperationException: A circular reference was detected while serializing an object of type Domain.<br> &nbsp;&nbsp; at System.Xml.Serialization.XmlSerializationWriter.WriteStartElement(String name, String ns, Object o, Boolean writePrefixed, XmlSerializerNamespaces xmlns)<br> &nbsp;&nbsp; at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write5_Domain(String n, String ns, Domain o, Boolean isNullable, Boolean needType)</font></p> <p><font color="#000000">So I've tried returning Domain[] I've tried returning Table&lt;Domain&gt; still get this serialization error.<br> Perhaps I need to create a datasource in the WebService then return the actual Datasource. But I am not sure if I can serialize datasources or not and then set them dynamically to the GridView via javascript.</font></p> <p>You might know since you wrote GridView though :) GridView rocks btw!</p> 2006-08-24T13:47:20-04:001380697http://forums.asp.net/p/1019304/1380697.aspx/1?Re+BLINQ+and+AtlasRe: BLINQ and Atlas <p>Based on the above. Any thoughts of what I could return from my webservice that would be serializable that I can set GridView's datasource to?</p> <p>Thanks and take care.</p> 2006-08-25T13:09:20-04:001381002http://forums.asp.net/p/1019304/1381002.aspx/1?Re+BLINQ+and+AtlasRe: BLINQ and Atlas <p>Well, the first thing that comes to mind is that a DataContext might not be serializable.&nbsp; I talked to the LINQ team about &quot;tear offs&quot;, or serializability, and they agreed that it was a scenario but didn't have time to make it work in the May LINQ Preview.</p> <p>The best place to get information on DataContext serializability is the <a href="http://forums.microsoft.com/msdn/showforum.aspx?forumid=123"> LINQ forum</a>.&nbsp;&nbsp; The LINQ team monitors it and will answer questions and take requests for features.</p> <p>Sorry I can't help you more.&nbsp; I hope the LINQ team can help.</p> 2006-08-25T18:00:09-04:001382001http://forums.asp.net/p/1019304/1382001.aspx/1?Re+BLINQ+and+AtlasRe: BLINQ and Atlas <p>Hi Polita,</p> <p>I have been following DLinq/BLinq dev evolution. AFAIK, its not intended to work natively with Oracle, MySql or other DB but SqlServer. Is it true? </p> <p>So after releasing the final version (any idea when it would be?), will it be others providers job to make this link between Linq and DB tech?</p> <p>Thanks!</p> <p>&nbsp;</p> 2006-08-27T18:46:23-04:001382801http://forums.asp.net/p/1019304/1382801.aspx/1?Re+BLINQ+and+AtlasRe: BLINQ and Atlas <p>Hope you had a good weekend!</p> <p>Thanks for the reply Polita.</p> <p>I can understand not everything works yet in the CTP's, that is fine. </p> <p>I also have some questions as I have been previewing a lot of the CTP's as of lately. We are a web shop deciding if we want to switch to ASP.NET and these CTP's are giving us great insight into if we will make the switch or not.</p> <p>From what I understand BLINQ does 2 things:<br> 1. Created classes that are bound to your DB so you can use OO for data access<br> 2. Auto-generate listing/insert/update/delete pages based off all of the generated classes in #1.</p> <p>So I have been starting to take a look at ADO.NET vNext CTP. What I am concerned is having seperate data layers half being the auto-generated BLINQ ones, and then using ADO.NET vNext for other things. Is it possible later versions of BLINQ will be using vNext for its objects rather than custom codegen classes?</p> <p>I really like the wizards ADO.NET vNext has, but I also really like what BLINQ has to offer with auto-generated pages. I really don't want to have 2 seperate OO data layers to work with on one site. </p> <p>Any insight on what the future holds would be great for our understanding of how things piece together. We have no problem waiting for things to mesh together in the CTP's but any insight on how all the pieces relate would be great.</p> <p>So far ASP.NET's new technology CTP's have us very interested, great work :)</p> 2006-08-28T16:50:43-04:001383165http://forums.asp.net/p/1019304/1383165.aspx/1?Re+BLINQ+and+AtlasRe: BLINQ and Atlas <p>rtortima-</p> <p>The May LINQ Preview supports only SQL Server.&nbsp; However, other providers will be supported when LINQ is released.</p> 2006-08-29T00:34:57-04:001390220http://forums.asp.net/p/1019304/1390220.aspx/1?Re+BLINQ+and+AtlasRe: BLINQ and Atlas <p>Polita,</p> <p>Can you please comment on my questions above? I am still concerned about having 2 branches of my data model created as objects for me and dealing with 2 API etc.</p> <p>Thanks and take care.</p> 2006-09-05T19:56:42-04:001390242http://forums.asp.net/p/1019304/1390242.aspx/1?Re+BLINQ+and+AtlasRe: BLINQ and Atlas synced, There is no public story for how LINQ and ADO.NET will interact, as far as I know.&nbsp; The best place to post questions about the future of the data model is on the <a href="http://forums.microsoft.com/msdn/showforum.aspx?forumid=123&amp;siteid=1">LINQ forum</a>. 2006-09-05T20:11:12-04:001390326http://forums.asp.net/p/1019304/1390326.aspx/1?Re+BLINQ+and+AtlasRe: BLINQ and Atlas <p>Hmm I see. I thought ADO.NET vNext was an actual product update? I just sort of see a bit of overlap where both ADO.NET vNext&nbsp; and BLINQ generate objects to access your DB. So if I am going to use BLINQ along with the next iteration of ADO.NET then I am going to have 2 seperate versions of my DB generated into classes, with different API.</p> <p>Honestly feel that I am getting confused by Microsoft blurring the lines too much. I love the power BLINQ has for auto-generating pages, but both BLINQ and ADO.NET vNext generate an object structure of your DB and if some components use ADO.NET vNext, and BLINQ doesn't use ADO.NET vNext objects, then I am basically forced to use both. Which seems like overkill to me.</p> <p>It could be I am just confused as well, very possible :) I am just concerned of having my DB generated twice and using 2 seperate API etc. Very confusing!</p> <p>Thanks for all your help throughout.</p> 2006-09-05T21:26:42-04:00