I've heard it said that the Entity Framework is overkill or that it's difficult to learn compared to LinqToSql.
I am wondering in what way? I used LinqToSql and like it. So, I am trying the EF and for the things I'm doing they seem almost exactly the same. Namespaces and method names are different but so far I don't see anything that...
I would like to read/write encrypted XML files using LINQ to XML. Does anyone know how to use encryption algorithms built into the .NET Framework to encrypt the Stream used by the XDocument object?
I did try it, but you can't set the CryptoStream to Read/Write access. It only support Read or Write, which causes LINQ to XML to throw an e...
I'm having some trouble figuring out how to use more than one left outer join using LINQ to SQL. I understand how to use one left outer join. I'm using VB.NET. Below is my SQL syntax.
T-SQL
SELECT
o.OrderNumber,
v.VendorName,
s.StatusName
FROM
Orders o
LEFT OUTER JOIN Vendors v ON
v.Id = o.VendorId
LEFT OUTER JOI...
Some background info;
LanguageResource is the base class
LanguageTranslatorResource and LanguageEditorResource inherit from LanguageResource
LanguageEditorResource defines an IsDirty property
LanguageResourceCollection is a collection of LanguageResource
LanguageResourceCollection internally holds LanguageResources in Dictionary<string...
Basically I am inserting an image using the listviews inserting event, trying to resize an image from the fileupload control, and then save it in a SQL database using LINQ.
I found some code to create a new bitmap of the content in the fileupload control, but this was to store it in a file on the server, from this source, but I need to...
What's the best way to write a LINQ query that inserts a record and then returns the primary key of that newly inserted record using C# ?
...
Lets say I have an array like this:
string [] Filelist = ...
I want to create an Linq result where each entry has it's position in the array like this:
var list = from f in Filelist
select new { Index = (something), Filename = f};
Index to be 0 for the 1st item, 1 for the 2nd, etc.
What should I use for the expression Index= ?...
I've got a Page class in my .edmx ADO.NET Entity Data Model file with with Parent and Children properties. It's for a hierarchy of Pages.
This is handled in my SQL database with a ParentId foreign key in the Page table bound to the Id primary key of that same Page table.
How do I display this hierarchy in a WPF TreeView?
...
What are the pros and cons of LINQ (Language-Integrated Query)?
What are the best and worst cases in which to use LINQ?
How have you benefitted or not benefitted from using LINQ?
Which data sources benefit the least and the most from LINQ?
...
I have two lists of custom objects and want to update a field for all objects in one list if there is an object in the other list which matches on another pair of fields.
This code explains the problem better and produces the results I want. However for larger lists 20k, and a 20k list with matching objects, this takes a considerable ti...
So I'm writing a page which does some reporting and it's pretty dynamic, the user has the ability to group data and sort columns. I've been able to get my dynamic grouping down and then the sorting except now my generated linq-to-sql sql order by statement is backwards from what I want it to be. I think I need to figure out how to get at...
I've got a class with Parent and Children properties.
I want to display this hierarchy in a WPF treeview.
Here's my XAML...
<TreeView Margin="12" Name="TreeViewPages" ItemsSource="{Binding}">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
<TextBlock Text="{Binding Path=Sho...
I've got a class with Parent and Children properties.
I want to display this hierarchy in a WPF treeview.
Here's my XAML...
<TreeView Margin="12" Name="TreeViewPages" ItemsSource="{Binding}">
<TreeView.Resources>
<HierarchicalDataTemplate DataType="{x:Type Page}" ItemsSource="{Binding Children}">
<TextBlock T...
Hi Guys,
I have been pushing to finish off this project since 1 week and have been stuck with one problem that god knows how I missed. We have a sql server database that has 2 tables (of concern here).
Table 1 (id,langCode,englishText,translatedTextInUnicode{nvarchar(MAX)})
Table 2 (id,langCode,englishText,translatedTextInUtf-8{...
table data of 2 columns "category" and "subcategory"
i want to get a collection of "category", [subcategories]
using code below i get duplicates. Puting .Distinct() after outer "from" does not help much. What do i miss?
var rootcategories = (from p in sr.products
orderby p.category
...
Hi all, still new to the world of linq, and i need some help flatening a list of parents that have children, into a single list of ParentChild's.
Just like this:
class Program
{
static void Main()
{
List<Parent> parents = new List<Parent>();
parents.Add(new Parent { Name = "Parent1", Children = new List<Child> ...
I'm working with an existing XML document which has a structure (in part) like so:
<Group>
<Entry>
<Name> Bob </Name>
<ID> 1 </ID>
</Entry>
<Entry>
<Name> Larry </Name>
</Entry>
</Group>
I'm using LINQ to XML to query the XDocument to retrieve all these entries as follows:
var items = from g in...
Is there some elegant way to add an empty option to a DropDownList bound with a LinqDataSource?
...
what is the right way of using XElement.Save(filepath)? Do I need to call this in a try/catch block all the time? How does it deal with concurrency?
...
Hey all,
Im having problems displaying records to my view when passing viewdata to a user control.
This is only apparent for linq to sql objects where I am using table joins.
The exception I receive is "Unable to cast object of type '<>f__AnonymousType410[System.String,System.Int32,System.Nullable1[System.DateTime],System.String,Syste...