|
|
April 2007 - Posts
-
I'm trying to loop the children of an EntitySet and run a function named NullToDates on each child. I don't know the type of the EntitySet, so I can't get a reference to it. (In my example I have it as type Object, but this cast fails). There are probably easier ways to do several things here. Please make other suggestions where appropriate. // There is probably an easier way to do this if (obj.GetType().ToString().Contains("EntitySet")) { // Get a reference to the entityset. System.Data.DLinq.EntitySet<Object> Read More...
|
-
Greetings from MIX07 everyone! That's right, Scott Guthrie announced this morning, to a sold out crowd at MIX07, the details around Silverlight, Microsoft's cross-browser, cross-platform plug-in for delivering the next generation of .NET based media experiences and Rich Interactive Applications (RIAs) for the Web. XML and Silverlight First, let me say how excited I am to begin discussions about Silverlight and XML. Even though all you clever XMLers may have forecasted it, for the past several months, Read More...
|
-
I found what might be a bug in SQLMetal. I'm using SQL Server 2005 SP2. I've created a table with a smalldatetime field with a default value of ((0)). When a new record is added to this table, the smalldatetime takes on a value of 01/01/1900 12:00:00 AM. This is correct. After SQLMetal generates an object, I create a instance of the object and the value of the smalldatetime property is 1/1/0001 12:00:00 AM. I'm not even sure what this date is, but it doesn't appear to be equivalen to 01/01/1900. Read More...
|
-
I have VS2005 with .Net Framework 2.0 installed. I wanted to play around with LINQ so I downloaded and installed ORCAS Beta 1 and then Visual Studio 2005 SP1. My Base OS is Windows XP Professional ( SP2). When I launch VS2005 and go to "About" it still continues to say .Net Framework 2.0 and I don’t get access to any of the LINQ namespaces namely System.Data.Linq etc can anyone help me out here. My Windows directory does have the following \Windows\Framework\V3.5...... Thanks, Read More...
|
-
hi, with the May CTP release, i used ObjectDataSource controls to supply data from a stored procedure, via the SqlMetal methods for the SP in question. this worked fine. however, when i try it now, the page chucks an exception: [InvalidOperationException: Invalid attempt to Read when reader is closed.] System.Data.SqlClient.SqlDataReader.ReadInternal(Boolean setTimeout) +502 System.Data.SqlClient.SqlDataReader.Read() +9 System.Data.Linq.SqlClient.ObjectReaderBase.Read() +33 System.Data.Linq.SqlClient.ObjectReader`1.MoveNext() Read More...
|
-
hi, in May CTP, i had this code and it ran fine, although it does cause a double enumeration which is not necessary: Code Snippet IEnumerable<Options_SELECTResult> results = this.Options_SELECT(Key); if (results.Count() == 0) return null; else return results.First().Value; now when i run this with the new LINQ 2.0.0.0 assemblies shipped with Orcas Beta 1, i get the following error. [InvalidOperationException: The query results cannot be enumerated more than once.] System.Data.Linq.SqlClient.SqlOneTimeEnumerable`1.GetEnumerator() Read More...
|
-
Hello, I have been playing around with the LINQ to SQL Designer and SQLMetal and have a question regarding updating the diagram. When developing, how come there is no way to refresh the diagram to take into account new changes within the database? The only way I can see how to do this is to delete the object (is object the right terminology?) and drag the table back on. I know SQLMetal can be used and this can be used as part of the build process which is great, but is SQLMetal an all or nothing Read More...
|
-
As I posted previously, the Beta1 docs are on-line. You can see them here: http://msdn2.microsoft.com/en-us/library/bb387098(VS.90).aspx In the upper right corner of each page, there are some stars, and 'click' to rate and give feedback. I've heard that this feedback mechanism is now active, and that any comments that you supply via this mechanism will reach me. But in any case, anyone is welcome to send feedback directly to me via this blog. I'll respond to all feedback personally, so please comment!! Read More...
|
-
OK, I've been out of the development world for a while. Coming back into it my C# is a little rusty. Add new features of C# and I can feel a little lost at times. I currently have LINQ Setup and running nicely on a project I'm developing. However, I am clueless as to how I select a specific record number in an IEnumerable object. Say I have the LINQ generated class Addresses which consists of many Address objects. I basically want to say give me Address #4 in the Addresses. How do I do this? There Read More...
|
-
In a number of places in the docs, I present code that finds nodes in the XML tree. Sometimes there are easy ways to describe the results of a query, but sometimes I wanted to describe the results of a query by specifically identifying exactly which nodes are selected by a query. Having a string that specifically identifies a node makes it easy to write sample code that selects specific nodes and then shows the exact results. Well, we already have a syntax that allows us to identify a specific node Read More...
|
-
First, I'm back blogging after a long absence - the last post was in October last year. I have my excuses! First, I was on paternity leave for the month of Dec. Second, I have been doing a deep dive into the LINQ to XML docs, and sometimes when I do a deep dive, I forget to take care of other essential tasks. Anyway, the LINQ to XML docs are coming along. I am not unhappy with the beta1 docs, and I am happy with the beta2 docs. The Beta1 docs are on-line. You can see them here: http://msdn2.microsoft.com/en-us/library/bb387098(VS.90).aspx Read More...
|
-
LINQ and DirectX 10 are two new things from Microsoft, but I wonder whether the two teams have colaborated at all.. Here is my question. What I want to do is something like this: In C# or C++ I would like to write: void blur(texture){ foreach pixel in texture{ pixel = (pixel[x-1][y ] + pixel[x][y ]+ pixel[x][y+1] )/3 } } i.e. using the LINQ syntax not just on lists but on collections of pixels in a texture which would then be accelerated by a DirectX 10 unified shader graphics card. This way you Read More...
|
-
I am having trouble databinding a WinForm DataGridView control to an XML LINQ collection. Below is a copy of the code I'm trying: private void btnLoadGridXML_Click( object sender, EventArgs e) { XDocument mediaDoc = XDocument .Load( "MyMedia.XML" ); var query = from m in mediaDoc.Descendants( "Media" ) select ( string )m.Element( "title" ); gridXML.DataSource = query.ToList(); } Below is a copy of what MyMedia.XML contains: <?xml version="1.0" encoding="utf-8"?> Read More...
|
-
I'm writing some internal tools that use LINQ, and am still on the May CTP release because upgrading to Orcas beta1 is a much bigger change and I'd have to run it in VPC. Our projects have Warning level 4, and 'treat warning as error'. I'm seeing a lot more warnings, and thus errors, using the C# 3.0 compiler. Things like 'unused variable', 'possible runtime exception' etc. e.g. the code - void foo() { X x = new X(); } gives a warning under C# 3 but not under 2.0. Is there a way around this so I Read More...
|
-
Hello, Just tried to rename one of my Linq to SQL (dbml) diagrams filename via Solution Explorer, it successfully renamed the .dbml and designer.cs however it did not rename .dbml.diagram Is this by design? Read More...
|
-
Hi guys, There is a Delay Loaded property in designer and properties with Delay Loaded = true are created as Link<> instances. However, it doesn't seem to affect the queries? Am I correct? If yes, I guess the implementation will follow.. Read More...
|
-
Hi, I have load the new VB samples and I wonder that there ist an syntax change. In the past a VB Linq Query looks like: (Amanda Silver shows this in the Video "PaulV-AmandaS_Demo.wmv") Dim lowNums = Select n _ From n In numbers _ Where n < 5 but now (and thats also in the samples) it looks: Dim lowNums = From n In numbers _ Where n > 5 _ Select n Have I miss something or is there anywhere an assertion of this? Thanks for you answer. Rupi Read More...
|
-
Hi All, We are building a business application where the presentation layer is built in Adobe Flex (flash 9) and the business and data tier are written in .NET. The communication between the 2 technologies is achieved using Weborb. This broker generates proxy classes for our .NET classes that are installed in the bin directory of the weborb webapp in iis. The flex code can then use these generated proxies on the client to access the business code. For the data layer we use Linq To Sql. The problem Read More...
|
-
Where can I see simple sample how to use DataShape instead of Including? I have this code: var referenced = from c in assembling.Computers where c.Computer_Id == 1 select c.Lot; referenced = referenced.Including(h => h.Model); Samples here http://forums.microsoft.com/msdn/showpost.aspx?postid=1275820&SiteID=1 don't give understanding :( Read More...
|
-
I got a NotSupportedException whiling using DLINQ togather with projection operation: var list = from p in prods where p.UnitPrice > 30 select new { p.ProductID, Description = string .Format( "{0} - {1}" , p.ProductName, p.UnitPrice) }; For what I understand, this is because Dlinq is attempting to translate the entire expression tree to SQL. But why? Could it keep some "calculation power" in the db access class it generates via CodeDom at runtime? It would be even more elegent Read More...
|
-
Hello, I recently started working with DLinq and have a very newbie question that I hope has a simple answer. I cannot after anything I have tried add rows to an in memory table. The code I am using resembles the following. DataContext context = new DataContext(); Table<MyTable> table = context.GetTable<MyTable>(); table.Add(new MyTable(Name = "MyName")); After this code, to me table should have a row in it, but table.Count returns a 0. If submit changes are called on the data Read More...
|
-
I'm confused about which products are actually in beta. With the release of Visual Studio Orcas beta 1, does this release include a *beta* version of the .NET Framework 3.5 (along with the LINQ technologies and new compilers), or are the framework and its associated language technologies in a final release state and just the IDE is in beta? I'm just trying to understand how stable the API's are in System.Query, etc. I'd like to start writing applications that target these API's, but only if they Read More...
|
-
I am working with VS Beta 1. First off, my compliments to the linq project because this will improve our lives in a big way. Now for my question... I have a M:M table1 relationship and in my linq query I want filter on the non existance in that relationship. So in my query I want to var query = from t2 in db.table2 where t2.table1s == null select t2 So I'm sure this is probably a trivial task, but at least in this form the query created throws an "and (0=1)". I'm assuming because "== Read More...
|
-
Hello I've created a concrete DataContext with approx. 15 tables (no sproc mappings). For performance reasons, I'm cloning the context. However, when invoking the .Clone() method on the context, I'm getting the following exception: "Constructor on type 'SphereWorks.Cms.Context.Data.CmsDataContext' not found." Code Snippet public Page GetPageEntity( Guid targetID) { using ( CmsDataContext db = new CmsDataContext ( SqlFactory .SqlConnectionString)) { CmsDataContext clone = db.Clone() as CmsDataContext Read More...
|
-
I see the assmebly System.Data.Linq in GAC, but I don't see it in Visual Studio/ Add Reference/ .NET Can sombedy explain this? Read More...
|
-
I've a stored procedure that uses a varchar parameter to retrieve records with a LIKE clause in the WHERE condition. Code Snippet ALTER procedure [dbo].[uspGetRoleDescription] @description varchar(50) as SELECT ID, RoleDescription FROM Role WHERE RoleDescription LIKE @description Generating the code from SQLMetal and/or the designer I can see a new class has been generated in order to contain the result of this stored procedure. Too bad! Because records belong to the same table I have already specified Read More...
|
-
hi, with the May CTP, i had a script to run SqlMetal on my db with the /sprocs parameter, and each time i modified the database i could just run this script and update my datacontext class automatically. the new O/R designer in Beta 1 is very intuitive and i had no trouble dragging on the tables and sprocs and using them in code. however, i usually deploy at least one update per day to the site i'm working on, and this could be very tedious to go deleting out any tables or sprocs that were modified, Read More...
|
-
Hi again, I tried to execute the same stored procedure (see my other post ) using the ExecuteCommand method: Code Snippet int iRet = this.ExecuteCommand("exec dbo.uspUpdateRegion @id={0}, @description={1}", original.RegionID, original.RegionDescription); The iRet value is equal to zero. Is it a method bug? Or what I did wrong? Thank you in advance. Read More...
|
-
EntitySet is a sealed class that doesn't implement INotifyCollectionChanged. Is there an easy way to get add/remove notifications to WPF when binding to an EntitySet contained inside an object? My binding is as follows: ItemsSource ="{Binding Source={StaticResource PageData}, Path=questions, Mode=TwoWay}" where "questions" is the path to an EntitySet. Thanks for any pointers. Read More...
|
-
I have a small example database with 3 related tables; Company, Currency and Country. The tables are related by foreigh keys so that a Company had a CountryId and CurrencyId. I have created a default Linq to SQL definition (in beta 1) and I can iterate through the existing data easily with a foreach() loop. However, if I add an item to the existing Companies collection before the iteration the Currency property of the Company object is null. If I however dispose the DataContext and reopen it the Read More...
|
-
... is the documentation written by Eric White. It won't leap out at you: It's necessary to explicitly install the "MSDN Library for Visual Studio Codename Orcas", and then navigate as follows: + Development Tools and Languages + Visual Studio + .NET framework Programming in Visual Studio + Language-Integrated Query (LINQ) + LINQ to XML There is literally enough content here to fill a decent-sized book, with lots of examples and sample data. There is a "Getting Started" section that compares LINQ Read More...
|
-
Hi Does anyone know of any resources that allow us to design and create "providers" (if this is the right term) so as to enable LINQ support for our datastore? Imagine you had some unusual database (for example something that stores object trees in files) and you wanted people to be able to manipulate that data using LINQ in their code, well what must one write and where is this documented? So far as I understand things, this is something Micorosft want to encourage, but I am not aware Read More...
|
-
I am really upset about the linQ progress and time is running out microsoft should speed up the development process . SIDE NOTE ABOUT REAL PROJECT IMPLEMENTATIONS ************************************************************* NOTE 1. We always have to remember the these namespaces using System; using System.Collections.Generic; using System.Linq; using System.Text; they should be included by default. NOTE 2. Tables name ending with "s " have problems in foriegn languages when we are using Read More...
|
-
Hi guys, I'm a bit confused about stored procedure usage in LINQ. When May CTP 2006 release has been shipped calling a stored procedure to insert, update or remove a record was very simple. You had to decorate the method with InsertMethod, UpdateMethod and DeleteMethod. LINQ saw the decoration and call the related method instead of generating SQL instructions. From March CTP 2007 Orcas and now with Beta 1 these attributes have been removed. The official documentation shows how to call a stored procedure Read More...
|
-
In Orcas Beta 1, on the LINQ to SQL designer, there is a "O/R Provider" property with the description "Controls which O/R Provider is used for Code Generation." This sounds intriguing to me, but I can't find any documentation on it, and it doesn't seem to be a property of DataContext, so I'm not clear the actual type this refers to. So, what is this property, and what exactly can we specify there? Also, is it possible to write our own O/R Provider, and in what cases would one Read More...
|
-
I've installed Visual C# Express 9.0 Express Edition and l play around with LINQ especially XLINQ... The problem is the XElement.Load can't seem to read the xml file... My code: var doc = XElement.Load(@"C:\u.xml"); when debugging I've got the "System.TypeInitializationException was unhandled" Please advice... Read More...
|
-
Hi, is there anybody who can explain me what the AutoSync Column attribute is? The official documentation is empty. Thank you in advance. Read More...
|
-
I've set up a fairly basic DataConext mapping using March 2007 Visual Studio Orcas. It works fine for reading data, but if I try to add something datacontext.Whatever.Add(new Stuff { ... }) I get an exception saying a message like this: "Can't perform Create, Update, or Delete operations on 'Table(dbo.Whatever)' because it is read-only." I didn't set it as readonly in the dbml file and have no idea why it would be readonly. Read More...
|
-
I've made two installs of Orcas Beta 1 from the 5.32-GB ISO image under Windows Vista Ultimate so far: 1) On a fresh 20-GB partition with Vista (Dell 400SC with 2.24-GHz P4 and 2GB RAM) and 2) On a virtualized Vista VM running under VS 2005 R2 RC1 on a Gateway S5200D 2.8-GHz Intel DualCore with 4GB RAM (1-GB assigned to the VM). Both were custom installs with VC++ and Crystal Reports features excluded. March 2007 CTP Sync Services apps and LINQ to SQL apps that didn't use the O/R Designer required Read More...
|
-
See Soma's post at http://blogs.msdn.com/somasegar/archive/2007/04/19/visual-studio-orcas-and-net-fx-3-5-beta1-shipped.aspx Read More...
|
-
I'm trying to add a new record to my DB using LINQ. The object has null datetime objects in it, so SQL Server is unhappy with me. Here's the code: AgendaDB db = new AgendaDB (connString); MyOrder order = new MyOrder (); db.AgendaOrder.Add(order); db.SubmitChanges(); I get the error: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM. Any suggestions on what to do? I need to use empty dates. Do I need to loop through all the properties of the object checking for Read More...
|
-
Can't see any references to SQLCacheDependency in all this LINQ stuff - is it possible to cache LINQ to SQL queries? Read More...
|
-
This is not actually a LINQ-related question, but one about this LINQ forum: I see 13 sticky threads on the main page and only 7 threads with actual questions. Do you think it's possible to balance it a little? In general forums have a ratio between questions and sticky threads much in the favor of the former, but here it's totally the reverse. And it's hard to browse throught it, especially for those who are here to answer other people's questions. Once a thread is moved to the second page, it's Read More...
|
-
Hi, Not a serious problem, but I'm not sure where else to post it. In the Express product, the Server Explorer is called Database Explorer, however on the Linq to SQL designer, it says drag it from the Server Explorer and not Database Explorer. Little bit confusing. Also, it would be cool if you included the NorthWind database file with the SQL Install like with SQL CE. Just so users can get up and running quicker. Just something I noticed initally as I was using it. Cheers Ben Read More...
|
-
As S. Somasegar announced , Orcas Beta 1 is ready to ship and will be generally available for download soon. There are some new (and renewed) features in LINQ to XML that you can check out in this release, and some minor changes introduced in response to reviews and comments: The "renewed" feature is XStreamingElement . As we noted previously , it was removed after the May 2006 CTP to keep the slate clean for possibly incompatible changes to support streaming. At the end of the discussion we concluded Read More...
|
-
XML Notepad 2007 source code is now available on http://www.codeplex.com/xmlnotepad . Enjoy! Read More...
|
-
With the release of Orcas Beta 1, the Visual Basic Team has also updated the Visual Basic LINQ samples today. Amanda Silver also has a post on the Visual Basic Team Blog on additional language and compiler features that made it into Beta 1. Enjoy, -B Beth Massi Program Manager VS Core Community Read More...
|
-
This was brought to my attention. Notice the LINQ to Objects example about halfway-down the page. jsc (c# to javascript) Very clever. Not unlike Nikhil's work with Script# . Read More...
|
-
See Soma's post at http://blogs.msdn.com/somasegar/archive/2007/04/19/visual-studio-orcas-and-net-fx-3-5-beta1-shipped.aspx Read More...
|
-
Ok folks, rev up your modems. Soma just announced the release of Orcas Beta 1. Hopefully I can download it before the servers are completely overloaded. You can see Soma's announcement at http://blogs.msdn.com/somasegar/archive/2007/04/19/visual-studio-orcas-and-net-fx-3-5-beta1-shipped.aspx#comments . Jim Wooley http://linqinaction.net http://devauthority.com/blogs/jwooley Read More...
|
-
The Visual Basic team has put together a "Live from Redmond" webcast series aimed at the next version of Visual Basic and Visual Studio code named "Orcas". Of these webcasts, the following will be presented on LINQ: Live From Redmond: VB9 - LINQ Overview April 25th, Presented by Kit George Live From Redmond: VB9 - LINQ to SQL & O/R Designer Deep Dive May 2nd, Presented by Young Joo Live From Redmond: VB9 - Deep Dive into LINQ May 23rd, Presented by Amanda Silver Live From Read More...
|
-
I am testing LINQ in Orcas March CTP with Linq to SQL on Northwind.. I was trying to extend the generated Customer class to add an ObjectDataSource select with a sort parameter, thus: Code Snippet <DataObjectMethod(DataObjectMethodType.Select)> _ Public Shared Function SelectAll( _ ByVal startRow As Integer , _ ByVal maxRows As Integer , _ ByVal sortBy As String ) As List( Of Customer) 'datacontext Dim db As New NorthwindDataContext() 'get customers (fixed sort) Dim q = ( From c In db.Customers Read More...
|
-
Any chance we'll see SQLMetal have a namespace option in the future? Like this: sqlmetal /namespace:MPG.Library ... Read More...
|
-
Hi, all. How can I use the update lockhint(UPDLOCK) optimization in DLINQ? I knew that the LINQ to SQL is designed primarily for optimistic concurrency( http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1344034&SiteID=1 ), but I want to use the pessimistic concurrency in some scenario. For example, how can I use the UPDLOCK in the below code? Code Snippet using (TransactionScope scope = new TransactionScope(TransactionScopeOption.RequiresNew)) { PubsDataContext db = new PubsDataContext(); Read More...
|
-
[ This is a C# 3 question. Sorry if this is the wrong forum, but I couldn't find a better one :-( ] Question Why do lambda expressions require parentheses for parameters, even when there are no parameters? If there is one implicitly-typed param, you can omit the parentheses, but you cannot omit them if there are no parameters at all. I.e. can write this for a lambda with a parameter SomeType o = new SomeType(); Method1( o => o.Foo ); but you cannot write this for a lamdba with no parameters SomeType Read More...
|
-
I'd like to try DLinq with Orcas March CTP I installed Orcas from http://www.microsoft.com/downloads/details.aspx?familyid=cf76fcba-07af-47ac-8822-4ad346210670&displaylang=en&tm According to the document http://download.microsoft.com/download/5/8/6/5868081c-68aa-40de-9a45-a3803d8134b8/dlinq_designer.doc I should create new project, selecting LINQ project type. I don't see this type in the list. Also I can not add noew DLinqObjects file. Possibly I have to install some addition to the Orcas Read More...
|
-
Hello, I have a MS Access 2003 database file, called winners.mdb, which contains a table with several columns. I'm mapping this table to a class called Winner like this: Code Snippet [ Table (Name= "winners" )] public class Winner { [ Column (IsPrimaryKey = true )] public int Year { get ; set ; } [ Column ] public string Name { get ; set ; } [ Column ] public string Country { get ; set ; } } When I'm trying to read the content of the file, I'm getting an exception. Code Snippet DataContext Read More...
|
-
I've got a table set up for class inheritance, as discussed in the DLinq Overview for C# Developers. Now I can't figure out how to get DLinq Designer to generate the different classes for me. I've got a Contact table with a DiscKey varchar(1). When 'C', it's a company. When 'P', it's a person. So I should have a Contact class, a Company class, and a Person class, where Company and Person derive from Contact. I haven't been able to figure out how to get the DLinq Designer to do this. Can anyone help? Read More...
|
-
Hi all, I am writing a class to explicit the Tree structure of expression tree (hence enabling visitors etc..), and I thought it would be good to use those nice testing feature from VS2005. But when in my testing code I define an expression, I get the following error : Test method DataStructureTest.ExpressionTreeTest.ChildrenTest threw exception: System.InvalidProgramException: Common Language Runtime detected an invalid program.. In this method lies only : [ TestMethod ()] public void ChildrenTest() Read More...
|
-
|
|