|
|
March 2007 - Posts
-
In my application I want to check if a record exists, if it does I want to update it, if it does not then I want to create a new record. Originally I just used the Single operator as follows: ADMUser admUser = myDBContext .ADMUser.Single< ADMUser >(c => c.ADMUserId == userId); if (admUser != null) { admUser.LastRegistered = DateTime.Now; } else { admUser = new ADMUser(); : : myDBContext.ADMUser.Add(admUser); } The first line of code caused an exception when there was no record matching which Read More...
|
-
hello, I am using the Orcas march CTP and Linq I have a problem with join between 2 tables let's say I have these tables : BaseProduct ProductID Code etc... AND Asset AssetID Code etc... While "code" is not considered as a primary key I coded this linq query : var query = from p in context.BaseProducts join a in context.Assets on p.Code equals a.Code where a.Code == "PRODSFJSDFJ0450" and when I look to the sql query executed, Linq doesn't generate a standard "inner join" Read More...
|
-
I've read that DLINQ currently support only SQL Server. But it looks like the DataContext constructor can accept an IDbConnection. I'm using Microsoft Enterprise Library-June 2005, Data Access Application Block which provides connectivity to an Oracle Database. The "DatabaseFactory" provides a "Database" object. A "System.Data.IDbConnection" can be retrieved using "GetConnection()" on the "Database" object. If this is passed as a parameter to "DataContext" Read More...
|
-
Can someone help me out in converting the reports generated using report viewer control into PDF format for Chinese - Traditional language? When I try to convert the reports that has been generated using the report viewer control in Chinese - Traditional language, certain characters get automatically converted into special charcters like "@". I have used MS Gothic font for the reports and the report is generated perefectly without any special characters when printed directly. But when converted Read More...
|
-
I am still using 2005May CTP (since it's an easy download), and wanted to mention two issues: 1. We have a database containing this clever table: CREATE TABLE [Calculation] ( [CalculationID] [bigint] IDENTITY (1, 1) NOT NULL , [User] [varchar] (50) COLLATE Latin1_General_CI_AS NOT NULL ) Now when Linq bravely tries to insert into this table, it doesn't realise that 'User' is a keyword, and issues an invalid insert. There is an easy workaround - go into generated C# code and change the line: [Column(Storage="_User")] Read More...
|
-
On the 2007March CTP download page , there is a note saying "Download the files most appropriate for you" I was wondering if that means that one could download a subset of the .rar files, and install Studio without MSDN? If so, would you know which files to download? The first one (part1.exe) seems to contain mostly MSDN ... Thanks, George Read More...
|
-
In the May 2006 LINQ CTP, the OrderBy operator was specified to perform an unstable sort, and it did in fact perform an unstable sort. Now, in the March 2007 Orcas CTP, the sort is performing a stable sort. Is this a change to the specification of the OrderBy and OrderByDescending operators, or is it just a fluke that cannot be counted on still? Read More...
|
-
Hello, I decided recently to use "Linq To Sql" version that came with the march CTP of Orcas, as I was using for a while the may 2006 version of the tool & librairies. The problem is that I have a lot of code working with my objects generated by sqlmetal and there is a little change that ... changes everything : My objects do not have the same name anymore ! Here is what happens : I have a database that contains a table " Import_History " with a Field " Source_Xml " Read More...
|
-
Hello, I have a question abaut the query visualizer that was in the linq may 2006 priview. I can't find him by the new VS Orcas marchCTP or by the marchCTP samples. Is it right that the visualizer is no longer in the new release? Is there a way to run him with the marchCTP? Thanks for your Help. Read More...
|
-
How do I install the LINQ to XSD Preview now that I have the Mar 2007 Orcas installed? The LINQ to XSD download wants the May 2006 version of Orcas to install. How do I get it to install with the new version of Orcas? Thanks for your Help. Read More...
|
-
Hi there, first time to the forum. I'm wondering if it's possible to submit partial changes with DLINQ. Let's say I have 2 Customer objects (Northwind), and if I want to update the "City" for both, I would go: //--------------------------------- cus_1.City = "LA"; cus_2.City = "NY"; db.SubmitChanges(); //--------------------------------- However, if I only want to submit the change on "cus_2", but ignore the change on "cus_1", how do I do that? Thanks Read More...
|
-
How do I insert explicit record into table with identity primary key using DLinq? I do import from external source and need to keep identity values. Using custom T-SQL command is not an option because this ruins main idea of using DLinq: compile-time error detection is not available. Thanks Martin Read More...
|
-
Hello, I want to ask my user in a application that uses LINQ if he wants to save the changes, does LINQ provide a property on a DataContext or elsewhere I can check if any objects have been changed? Or do I have to maintain my own variable to track changes??? Best Regards, Klaus Enevoldsen Read More...
|
-
Hi Not sure why this is happening - I was trying a spurious example and the aforementioned exception is thrown. var query13 = from p in db.Products select p.ProductName; var query14 = from c in db.Customers select c.ContactName; if (!query13.SequenceEqual(query14)) { Console.WriteLine("OMG, the list of product names doesn't equal the list of contact names!"); } Am I doing something wrong here? Chris Read More...
|
-
Hi I've been grokking the C# 3.0 spec yesterday, and I for the most part, understand it from a logical point of view. It's actually really cool! The only thing that's really irking me at the moment is how you would use expression trees in a practical way. Is there anyone that can provide a few pointers/URLs on how this could be used in a real-world application? Chris Read More...
|
-
I use a " code-first, database-last " development process with LINQ, where I create my Entity classes by hand, add business logic (carefully using partial classes), and unit test them. Once I'm happy with things, I'll add the database tables and do the mapping. This is simply works better than a "database-first, code last" development process for me. I've had some challenges using DLINQ along the way. Bottom-line is, I would like to write my business logic to use an in-memory Read More...
|
-
-
In the first post in this series we gave some background to a problem the LINQ to XML design team has been working on for some time: how to easily yet efficiently work with very large XML documents. In today's world, developers have a somewhat unpleasant choice between doing this efficiently with fairly difficult APIs such as the XmlReader/XmlWriter or SAX, and doing this easily with DOM or XSLT and accepting a fairly steep performance penalty as documents get very large. Let's consider a real world Read More...
|
-
Just been trying out LINQ to SQL in the current *March 07* CTP of Orcas - could not find any Feedback forums for LINQ so I'll post my queries here. These all relate to System.Data.LINQ and dbml data class generation. 1) No support for user defined types? I would like to be able to map a database int column directly onto an Enum for example, e.g. change System.Int32 to MyEnum in properties for a .dbml MemberPropery 2) No auto-generated collection classes? Although LINQ to SQL generates the instance Read More...
|
-
In the April/May time frame there will be three public chats by the C# Team. April 23, 2007, 11 AM Pacific Time C# Visual Studio IDE Chat : Talk about C# IntelliSense for LINQ. Discuss what else is planned for Visual Studio Orcas. Plus: Code snippets, enhanced IntelliSense, type colorization, refactoring, improved code navigation, metadata as source, Edit and Continue and all the other great new C# IDE features in Visual Studio 2005. There's a lot to talk about! It's your choice! Join the C# IDE Read More...
|
-
Hi I have an app with about 60 tables in the DB. If a user makes a change, the change is added to a generic Pending table that lists the source table, column , record id, new value, time, etc. but the change isn't made to the source table until the change is approved. When approved, I need to take the record, find the table that needs updating, find the record and the column and do the update. I think the way to do it is to create a generic method that takes a table type, reflect on the table so Read More...
|
-
New features include support for XInclude, Goto Definition, XSD annotations in tooltips, a new navigation combo box for opening XML directly off HTTP, new menus for changing node types, better handling of XML documents containing illegal characters plus a lot of bug fixes. See Updates.xml for full list of changes and link to download. PS: the new download size is 1.81mb, if you do not see this hold down the control key when you click the download button to update your IE cache. Read More...
|
-
I wrote this to help visualize what AST trees really looked like. It's a helper class that implements IOrderedQueryable<T> and does nothing but dump the AST passed to CreateQuery to XML. It's quick-and-dirty code but seems to work, hopefully someone finds it helpful since ASTs aren't really well documented yet. Linq.Utilities Source Code Example Test: QueryLogger < FileInfo > files = new QueryLogger < FileInfo >(Writer); var q = from file in files where file.Name == "test.bat" Read More...
|
-
Hello, I would like to be able to sort by DataGridView objects that are bound to objects of type BindingList<T> explicitly or implicitly through a BindingSource by using the default functionality provided by the grid when column headers are clicked. In order to do this, I have to derive a class from BindingList<T> and implement the appropriate property and method overrides for this functionality to work. I have done this by creating a class called SortableBindingList<T>, and sorting Read More...
|
-
Hi Everybody, I get the following exception on Inserting or Updating the db (non express sql2k5 sp1) with DLinq (May CTP). We had no such problem with the PDC release of DLinq, but we switched to the May CTP what introduced this bug. Is there any chance for a fix? What can I do for it? Thanks for any help for advance: Kazi System.ArgumentNullException was unhandled Message="Value cannot be null.\r\nParameter name: body" Source="System.Query" ParamName="body" StackTrace: Read More...
|
-
Hi I'm trying to dynamically build query using public static IEnumerable <V> Join<T, U, K, V>( this IEnumerable <T> outer, IEnumerable <U> inner, Func <T, K> outerKeySelector, Func <U, K> innerKeySelector, Func <T, U, V> resultSelector); I have base class called BizObject which is base class for all entities. The current argorith is following First I do IQueryable source = context.GetTable( typeof (T)); Where T is a first (basic) entity type and type of returned Read More...
|
-
I am new in Linq, I created csarp class for Northwind dbase in SqlMetal.exe. I liked how I can access foreign key columns using property... in Orders table, there is Orders . CustomerID column referencing Customer.ID and it is great to access Customer this way ... Order myOrder ... myOrder.CustomerID and myOrder.Customer ... but when I used SqlMetal.exe on my simple table, it does not generate referenced object property but only it's id :[ So where is the problem? My table is simple, something like Read More...
|
-
Hi, An error is been produced in the method "count" after it had been ran this query Dim q = From Art In oTablaArtic _ Where Art.Nombre Like "N*" _ Select Art.Nombre, Art.ID ? q.count Method 'Boolean LikeString(System.String, System.String, Microsoft.VisualBasic.CompareMethod)' has no supported translation to SQL. Thanks Read More...
|
-
Hi, How can I get the attribute values "Column" from fields of a table through code: DbType, CanBeNull ... Example: <Table(Name:="Articulos")> _ Public Class Articulos <Column(DbType:="INT NOT NULL IDENTITY(1,1)", CanBeNull:=False, IsPrimaryKey:=True)> Public ID As Int32 <Column(DbType:="NVarChar(100) NULL", CanBeNull:=True)> Public Nombre As String End Class Something like: Articulos.Nombre.DbType Thanks Read More...
|
-
Hi there, I have been reading up on Linq to SQL and the new ADO.NET Entity Data Model lately. I have also been playing around with both of them in the latest Orcas CTP. One thing that is still unclear to me is why both technologies exist at the same time. It seems that the ADO.NET Entity Data Model is capable of doing evertyhing that Linq to SQL can do, so what's the point of having the separate Linq to SQL technology? Can someone explain the reasoning for having these two (seemingly) similar technologies? Read More...
|
-
Hi, I'm trying to do the LINQ equivalent of the following SQL SELECT * from tbl where id IN (10, 20, 30) which would return all rows with id equal to 10, 20 or 30. I have an array/list in code containing the values e.g. 10, 20 & 30. I want to return all rows whose ids are in this array. I have tried var q = from x in tbl where arrayOfIds.Contains(x.id) but this hasn't worked. Any help greatly appreciated. Read More...
|
-
Thanks for the info Jamie I tried registering mine and even though it said it registered successfully it still crashed the Itunes set-up with the VB error. Any other ideas? I also tried installing VB 5.6 for XP but still no go. Wonder if it is because I runt he 64bit version? Thanks for any help Read More...
|
-
Within the scope of a using transactionscope statement, I call many other functions, some of which in turn call SubmitChanges to submit the changes to the database. Is there any way that I can undo all of the changes that have been submitted to the database when a transaction fails, including those submitted with SubmitChanges? Any suggestions would be much appreciated! Read More...
|
-
Hi I would like to create my Data Access Layer in DLINQ and Make it available as WCF service. I know that SQLMetal (this release) doesn't produce <DataContract> and <DataMember> Attributes in my DataContext class. So I manually tried to add it. Will that work properly? If anyone tried this approach please send me the sample code. Thanks Vinoth Read More...
|
-
I am having issues installing the March CTP, so I am installing the May CTP but I am still get squigglies, which probably means my C# language service isnt installed correctly. The install script ran fine though...Any ideas? Read More...
|
-
Generated a SQLMetal object layer from Northwind. It generated the Customer Class with a CustomerID field of type string instead of an integer. Why did this happen? Read More...
|
-
Playing around with LINQ and: SqlConnection con = new SqlConnection(@"Data Source=. SQLExpress;Initial Catalog=Northwind;Integrated Security=SSPI"); Northwind db = new Northwind(con); var q = from c in db.Employees where c.EmployeeID == 1 select new { c.FirstName, c.LastName, c.HireDate, c.HomePhone }; dataGridView1.DataSource = q; This produces a grid as Last Name, Hire Date, First Name, Home Phone. Why is it a different order then my anonymous type? How can I influence the order of the Read More...
|
-
I have been testing LINQ To SQL and I have a lot of feed back, both bugs and suggestions. I have reported them all to http://connect.microsoft.com/visualstudio/feedback BUT now I am getting replies back that I should not use the visual studio part of connect to report these issues, but SQL Server! Could this really be true, should I report bugs in the OR designer in VS Orcas to the SQL Server Team? https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=263496 https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=26349 Read More...
|
-
Will DLINQ, and DataContext object support a SQL Server 2005 CE database? Ever? I know with the March 07 CTP that it does not support it, as I would pass a long path to my .sdf file and it would break because the Data Source is too long... I also noticed that the Connection property of the DataContext was instanced as a SqlClientConnection... but I guess the Connection is actually an IDbConnection interface... I'm guessing there's a way to extend this to use a SqlCeConnection object.. Any thoughts Read More...
|
-
Is there a simple way to make the .dbml.diagram file update based on changes I make to my database in SQL Server Management Studio Express? I tried to simply delete all the tables and then drag them back from the Server Explorer, but when I do this, I lose all of the lines representing the foreign keys. So what I have been doing is deleting the dbml file, then adding a new Linq to SQL file, and then dragging the tables onto the dbml file. This isn't tragic, but it's a bit of a pain. Am I missing Read More...
|
-
Hello .Net Gurus: I want to bind one column of table with the grid view with the following syntax ,but unable to do it, in the following code Me .dgTax.DataSource = dsTax.Tables(0).Columns( "Tax_Process" ) or Me .dgTax.DataSource = dsTax.Tables(0).Columns(1 ) Me .dgTax.Refresh() i can see the whole table when i bind as below Me .dgTaxProcess.DataSource = dsTax.Tables(0) Me .dgTaxProcess.Refresh() I appreciate ur respone Ramzan Read More...
|
-
Hello .Net Gurus: I want to bind one column of table with the grid view with the following syntax ,but unable to do it, in the following code Me .dgTax.DataSource = dsTax.Tables(0).Columns( "Tax_Process" ) or Me .dgTax.DataSource = dsTax.Tables(0).Columns(1 ) Me .dgTax.Refresh() i can see the whole table when i bind as below Me .dgTaxProcess.DataSource = dsTax.Tables(0) Me .dgTaxProcess.Refresh() I appreciate ur respone Ramzan Read More...
|
-
Hi, What happened to the SqlMetal generated implementation of INotifyPropertyChanged/Changing interfaces in March 2007 CTP? The property name no longer seems to be passed in: March 2007 CTP: <pre> protected virtual void OnPropertyChanging() { if ((this.PropertyChanging != null)) { this.PropertyChanging(this, emptyEventArgs); } } protected virtual void OnPropertyChanged() { if ((this.PropertyChanged != null)) { this.PropertyChanged(this, emptyEventArgs); } } </pre> June 2006 CTP: <pre> Read More...
|
-
I'm trying to compose the first block of expression using expression trees. The second block compiles fine. But the third block generates a "Lambda Parameter not in scope" error. All 3 blocks generate the same expression "{(x, y) => Multiply(x, y)}". There seems to be some pre-condition in Expression.Multiply that checks whether the ParameterExpressions passed to it is in the list of expression passed to the lambda expression. I'm assuming the the call to Expression .Parameter( Read More...
|
-
Hello. In the May 2006 CTP for VS2005 there was a neat feature when working with a DataContext to eagerly load 1:M relations like [Customer, Order], by simply tagging along the .Including(c => c.Orders) With Mars 2007 CTP on Orcas this extention method is not there anymore. After a long session with google, I finally had a look at the updated samples from Mr Calverts blog. In those updated samples the eager loading demo using Including was commented out and instead there was an example using DataShape() Read More...
|
-
Help me... I need C# coding in ASP.Net webapplication i've two column... One for msg another for msgLastpostedtime In My application Design side Repeater control(any control).In label control automatically view Msg(last 5 Msg one by one 2 minutes time intervael every Msg).... Example Table --------------------------------------------- Msg | MsgLastPosedtime asd |2007-03-12 10:50:25.747 dfs |2007-03-12 10:56:36.373 Sql |2007-03-12 11:00:25.047 Uer |2007-03-12 11:02:10.793 dsw |2007-03-12 13:07:51.233 Read More...
|
-
I don't see it. Has it been renamed? Is it gone for good? Read More...
|
-
Now you see it (May 2006), now you don't (March 2007). What happened? Is it gone for good, or just not up to snuff yet in Orcas? Thanks. Read More...
|
-
In our application we have used SQLMetal to generate classes based on an SQL Server 2005 Database. As a bit of an experiment we then use the DataContext CreateDatabase() method to create a .mdf file (i.e. a SQL Express 2005 database) from code at runtime (we have our reasons for trying to do this ). The 2 databases compared very well with a couple of exceptions: 1. None of the SQL Express tables had constraints. 2. Some tables that had foreign key relationships had the delete rule set to 'No Action': Read More...
|
-
Is Linq to sql is only specific to sql server or it have support for other databases {Like oracle, Mysql, ms access} ? Read More...
|
-
Can somebody please let share knowledge about Transaction Support in LINQ. I am particular to linq to sql and link to dataset. Read More...
|
-
I am trying to fill a GridView with a query based on DataTable and DLinq class object. Following is the compilation error that i faced ( before writing DataTable,Rows.ToQueryable() ) -- The best overloaded method match for 'System.Query.Queryable.ToQueryable(System.Collections.IEnumerable)' has some invalid arguments. After using DataTable,Rows.ToQueryable() -- i am facing following runtime errror -- source is not IEnumerable<> Following is my code snippet --- ------------------------------------------------------------------------------------------------------ Read More...
|
-
I want to do the following, but I'm getting errors: [ WebMethod ] public Employee GetEmployeeByID( Guid employeeID) { Employee employee = new Employee (); using ( MyDataContext bm = new MyDataContext (conn)) { employee = bm.Employees.Single(e => e.EmployeeID == employeeID); } return employee; } Is this not supported? (Employee is a DLinq created object) Read More...
|
-
I have spotted at least one difference between the virtual image and self-extracting installs. The path for the Visual Studio Codename Orcas Command Prompt includes the path to SQLMetal for the virtual image, but the self-extracting install does not. To get to the directory containing SQLMetal.exe, change your directory to ..\SDK\v3.5\Bin cd ..\SDK\v3.5\Bin http://www.linqdev.com/publicportal/Forums/tabid/256/forumid/9/postid/37/view/topic/Default.aspx Read More...
|
-
Rather than putting each class in one large huge .cs file - could it be made an option to have them split up into separate classes? Also - would it be possible to select the tables, views, and stored procs rather than just generate everything regardless? I noticed the Entity Framework brings up a dialog that shows the tables listed that you can check/uncheck. Something similiar to this would be fantastic. Thanks Read More...
|
-
One of my major pet peaves with the current TableAdapter approach is that it is putting the connection string information into the settings file. I have noticed that when using DLinq Designer, it uses this same approach. Now, on the other hand, the Entity Framework uses the config file. Could the development team make it an option for the developer where to store the connection string? We encrypt our connection strings, etc... and having this in the settings file is a major headache for both this Read More...
|
-
Hello, I'm trying to convert May 2006 CTP VB samples to the new Orcas March 2007 release. I'm not able to use the Group By operator because the compiler seems to not recognize it. For example, is it possible to convert this snippet code: Dim query = From m In GetType(Integer).GetMethods() _ Group By m.Name _ Select New With {Name = it.Key, Overloads = it.Count} Thank you in advance. Read More...
|
-
I have some "directory" tables in my DB and all of them have shared properties: "Id" and "Name". So, in my c# code i created a base class DirectoryBase with this properties. Mapping is described in external XML file. When i try to itterate throw my concrete directory entity, i got "null reference exception". How should i change my XML mapping file to say dlinq that my classes are inherited? Thanks Read More...
|
-
Hi, As a part of our MSXML4 End of Life plan , we are going to kill bit MSXML4 in the October – December timeframe of this year . Kill Bit applies to Internet Explorer only. After the kill bit , applications will not be able to create MSXML4 objects in the browser.(Add link for killbit) Applications outside IE like C++ apps will continue to work with MSXML4. We are announcing this in advance so that our customers get sufficient time to try their applications with MSXML6 and give us feedback on their Read More...
|
-
Contents Upgrading to MSXML 6.0 . 1 1. Abstract 1 2. Installation & Upgrade . 2 3. Security Migration – Understanding Off-By-Default 3 4. Improving W3C XSD 1.0 Conformance & Compatibility with System.Xml 2.0: Changes to the XmlSchemaCache: 7 5. Obsolete features/Classes . 8 Abstract Microsoft Core XML Services (MSXML) 6.0 is the current version of the core XML stack in the COM / Scripting environment. This document covers installation of MSXML6 and application upgrade, supported operating Read More...
| |
|