LINQ (Language Integrated Query) allows querying of data from various sources using a consistent set of operations. It utilizes language features like lambda expressions, extension methods, and anonymous types to enable querying of objects, datasets, XML, and other sources. LINQ queries can select, filter, and order data in a manner similar to SQL and return strongly typed results without needing to define custom classes.
A small presentation I developed that introduces lambda expressions and many of the common LINQ extension methods for a group of developers that were less familiar with these concepts.
Talk slides from the Functional Programming eXchange 2012 on F# type providers. Examples include WorldBank data, SQL, OData and WSDL as well as structure inference for XML files.
Anonymous types use the keyword var. Var is also used in Pascal and Delphi today, but var in Delphi is like ByRef in Visual Basic (VB) or ref in C#. The var introduced with .NET 3.5 indicates an anonymous type. Now, our VB friends are going to think, “Well, we have had variants for years in VB.” But var is not a dumbing down and clogging up of C#. Anonymous types are something new and necessary.
FireWatir - Web Application Testing Using Ruby and Firefoxangrez
FireWatir is a tool used for functional testing a web application using Ruby and Firefox browser. You can use the scripts written using WATiR that targets IE with slight changes with FireWatir
"You know the basics of Resharper. In this presentation I show you what's next."
I gave this presentation as a follow up on an earlier one that showed the very basics of Resharper. This time I demonstrated things like code analysis, project-level assistance, unit testing, code generation, navigation and search and templates.
A small presentation I developed that introduces lambda expressions and many of the common LINQ extension methods for a group of developers that were less familiar with these concepts.
Talk slides from the Functional Programming eXchange 2012 on F# type providers. Examples include WorldBank data, SQL, OData and WSDL as well as structure inference for XML files.
Anonymous types use the keyword var. Var is also used in Pascal and Delphi today, but var in Delphi is like ByRef in Visual Basic (VB) or ref in C#. The var introduced with .NET 3.5 indicates an anonymous type. Now, our VB friends are going to think, “Well, we have had variants for years in VB.” But var is not a dumbing down and clogging up of C#. Anonymous types are something new and necessary.
FireWatir - Web Application Testing Using Ruby and Firefoxangrez
FireWatir is a tool used for functional testing a web application using Ruby and Firefox browser. You can use the scripts written using WATiR that targets IE with slight changes with FireWatir
"You know the basics of Resharper. In this presentation I show you what's next."
I gave this presentation as a follow up on an earlier one that showed the very basics of Resharper. This time I demonstrated things like code analysis, project-level assistance, unit testing, code generation, navigation and search and templates.
LINQ
The acronym LINQ stands for Language Integrated Query. Microsoft’s query language is fully integrated and offers easy data access from in-memory objects, databases, XML documents, and many more. It is through a set of extensions, LINQ ably integrates queries in C# and Visual Basic. This tutorial offers a complete insight into LINQ with ample examples and coding. The entire tutorial is divided into various topics with subtopics that a beginner can be able to move gradually to more complex topics of LINQ.
Force.com can automatically generate user interfaces, but in some cases you might want to build a more custom UI. Join us to learn about Visualforce, the component-based UI framework that lets you build attractive, dynamic, reusable user interfaces. We'll cover code walk-throughs, common use cases, leveraging Apex on the server side, debugging techniques, and how to utilize the component framework to make your code portable and maintainable.
Accessing loosely structured data from F# and C#Tomas Petricek
Slides from my talk at GOTO 2011. The presentation discusses how to bridge the impedance mismatch between the structure used in programming languages (classes, records, unions, ...) and structure used in data sources (database schema, XML file or JSON document). The talk shows how to solve this problem at three scales - using dynamic typing, by defining structure explicitly and using F# type providers.
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
Sudheer Mechineni, Head of Application Frameworks, Standard Chartered Bank
Discover how Standard Chartered Bank harnessed the power of Neo4j to transform complex data access challenges into a dynamic, scalable graph database solution. This keynote will cover their journey from initial adoption to deploying a fully automated, enterprise-grade causal cluster, highlighting key strategies for modelling organisational changes and ensuring robust disaster recovery. Learn how these innovations have not only enhanced Standard Chartered Bank’s data infrastructure but also positioned them as pioneers in the banking sector’s adoption of graph technology.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
Dr. Sean Tan, Head of Data Science, Changi Airport Group
Discover how Changi Airport Group (CAG) leverages graph technologies and generative AI to revolutionize their search capabilities. This session delves into the unique search needs of CAG’s diverse passengers and customers, showcasing how graph data structures enhance the accuracy and relevance of AI-generated search results, mitigating the risk of “hallucinations” and improving the overall customer journey.
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...Neo4j
Leonard Jayamohan, Partner & Generative AI Lead, Deloitte
This keynote will reveal how Deloitte leverages Neo4j’s graph power for groundbreaking digital twin solutions, achieving a staggering 100x performance boost. Discover the essential role knowledge graphs play in successful generative AI implementations. Plus, get an exclusive look at an innovative Neo4j + Generative AI solution Deloitte is developing in-house.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
GridMate - End to end testing is a critical piece to ensure quality and avoid...ThomasParaiso2
End to end testing is a critical piece to ensure quality and avoid regressions. In this session, we share our journey building an E2E testing pipeline for GridMate components (LWC and Aura) using Cypress, JSForce, FakerJS…
Removing Uninteresting Bytes in Software FuzzingAftab Hussain
Imagine a world where software fuzzing, the process of mutating bytes in test seeds to uncover hidden and erroneous program behaviors, becomes faster and more effective. A lot depends on the initial seeds, which can significantly dictate the trajectory of a fuzzing campaign, particularly in terms of how long it takes to uncover interesting behaviour in your code. We introduce DIAR, a technique designed to speedup fuzzing campaigns by pinpointing and eliminating those uninteresting bytes in the seeds. Picture this: instead of wasting valuable resources on meaningless mutations in large, bloated seeds, DIAR removes the unnecessary bytes, streamlining the entire process.
In this work, we equipped AFL, a popular fuzzer, with DIAR and examined two critical Linux libraries -- Libxml's xmllint, a tool for parsing xml documents, and Binutil's readelf, an essential debugging and security analysis command-line tool used to display detailed information about ELF (Executable and Linkable Format). Our preliminary results show that AFL+DIAR does not only discover new paths more quickly but also achieves higher coverage overall. This work thus showcases how starting with lean and optimized seeds can lead to faster, more comprehensive fuzzing campaigns -- and DIAR helps you find such seeds.
- These are slides of the talk given at IEEE International Conference on Software Testing Verification and Validation Workshop, ICSTW 2022.
Pushing the limits of ePRTC: 100ns holdover for 100 daysAdtran
At WSTS 2024, Alon Stern explored the topic of parametric holdover and explained how recent research findings can be implemented in real-world PNT networks to achieve 100 nanoseconds of accuracy for up to 100 days.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024Neo4j
Neha Bajwa, Vice President of Product Marketing, Neo4j
Join us as we explore breakthrough innovations enabled by interconnected data and AI. Discover firsthand how organizations use relationships in data to uncover contextual insights and solve our most pressing challenges – from optimizing supply chains, detecting fraud, and improving customer experiences to accelerating drug discoveries.
In his public lecture, Christian Timmerer provides insights into the fascinating history of video streaming, starting from its humble beginnings before YouTube to the groundbreaking technologies that now dominate platforms like Netflix and ORF ON. Timmerer also presents provocative contributions of his own that have significantly influenced the industry. He concludes by looking at future challenges and invites the audience to join in a discussion.
10. Language Features That Support LINQ Query Expressions Query expressions in Visual Basic 2008 can be expressed in a declarative syntax similar to that of SQL or XQuery. At compile time, query syntax is converted into method calls to a LINQ provider's implementation of the standard query operator extension methods. Applications control which standard query operators are in scope by specifying the appropriate namespace with an Imports statement. Syntax for a Visual Basic query expression looks like this: Dim londonCusts = From cust In customers _ Where cust.City = "London" _ Order By cust.Name Ascending _ Select cust.Name, cust.Phone
11. LINQ Query Syntax Shaping the output select <expression> Projection Aggregate the source items count([<expression>]), sum(<expression>), min(<expression>), max (<expression>), avg(<expression>) Aggregate Control the ordering of the results order by <expression>, <expression> [Ascending | Descending] Order Expression specifying the selection Criteria where <expression>, distinct Filter Information source providing a set of item (s) from <item> in <data source> Source Using type inference to assign the resulting value(s) var <variable> = Destination
12. Language Features That Support LINQ Implicitly Typed Variables Instead of explicitly specifying a type when you declare and initialize a variable, you can now enable the compiler to infer and assign the type, as shown in the following example. This is referred to as local type inference. ' The variable number will be typed as an integer. Dim aNumber = 5 ' The variable name will be typed as a String . Dim aName = "Virginia"
13. Language Features That Support LINQ Object Initializers Object initializers are used in query expressions when you have to create an anonymous type to hold the results of a query. They also can be used to initialize objects of named types outside of queries. By using an object initializer, you can initialize an object in a single line without explicitly calling a constructor. Assuming that you have a class named Customer that has public Name and Phone properties, along with other properties, an object initializer can be used in this manner: Dim aCust As Customer = New Customer With {.Name = "Mike", _ .Phone = "555-0212"}
14. Language Features That Support LINQ Anonymous Types Anonymous types provide a convenient way to temporarily group a set of properties into an element that you want to include in a query result. This enables you to choose any combination of available fields in the query, in any order, without defining a named data type for the element. An anonymous type is constructed dynamically by the compiler. The name of the type is assigned by the compiler, and it might change with each new compilation. Therefore, the name cannot be used directly. Anonymous types are initialized in the following way: ' Outside a query. Dim product = New With {.Name = "paperclips", .Price = 1.29} ' Inside a query. ' You can use the existing member names of the selected fields, as was ' shown previously in the Query Expressions section of this topic. Dim londonCusts1 = From cust In customers_ Where cust.City = "London“ _ Select cust.Name, cust.Phone ' Or you can specify new names for the selected fields. Dim londonCusts2 = From cust In customers _ Where cust.City = "London" _ Select CustomerName = cust.Name, _ CustomerPhone = cust.Phone
15. Language Features That Support LINQ Extension Methods Extension methods enable you to add methods to a data type or interface from outside the definition. This feature enables you to, in effect, add new methods to an existing type without actually modifying the type. The standard query operators are themselves a set of extension methods that provide LINQ query functionality for any type that implements IEnumerable(Of T) . Other extensions to IEnumerable(Of T) include Count , Union , and Intersect . ' Import System.Runtime.CompilerServices to use the Extension attribute. <Extension()> _ Public Sub Print(ByVal str As String) Console.WriteLine(str) End Sub Dim greeting As String = "Hello" greeting.Print() The following extension method adds a print method to the String class. The method is called like an ordinary instance method of String :
16. Language Features That Support LINQ Lambda Expressions A lambda expression is a function without a name that calculates and returns a single value. Unlike named functions, a lambda expression can be defined and executed at the same time. The following example displays 4. Console.WriteLine((Function(num As Integer) num + 1)(3)) You can assign the lambda expression definition to a variable name and then use the name to call the function. The following example also displays 4. Dim add1 = Function(num As Integer) num + 1 Console.WriteLine(add1(3)) In LINQ, lambda expressions underlie many of the standard query operators. The compiler creates lambda expressions to capture the calculations that are defined in fundamental query methods such as Where, Select, Order By, Take While, and others. For example, the following code defines a query that returns all senior students from a list of students. Dim seniorsQuery = From stdnt In students Where stdnt.Year = "Senior" Select stdnt The query definition is compiled into code that is similar to the following example, which uses two lambda expressions to specify the arguments for Where and Select. Dim seniorsQuery2 = students Where(Function(st) st.Year = "Senior") Select(Function(s) s)
17. More On Queries Like normal SQL queries we can do the following operations by using LINQ expressions Describes the Skip clause, which bypasses a specified number of elements in a collection and then returns the remaining elements. Skip Clause Describes the Select clause, which declares a set of range variables for a query Select Clause Describes the Order By clause, which specifies the sort order for columns in a query. Order By Clause Describes the Let clause, which computes a value and assigns it to a new variable in the query. Let Clause Describes the Join clause, which combines two collections into a single collection. Join Clause Describes the Group Join clause, which combines two collections into a single hierarchical collection. Group Join Clause Describes the Group By clause, which groups the elements of a query result and can be used to apply aggregate functions to each group. Group By Clause Describes the From clause, which specifies a collection and a range variable for a query. From Clause Describes the Distinct clause, which restricts the values of the current range variable to eliminate duplicate values in query results. Distinct Clause Describes the Aggregate clause, which applies one or more aggregate functions to a collection Aggregate Clause Descriptions Clause Name
18. More On Queries Like normal SQL queries we can do the following operations by using LINQ expressions Describes the Skip While clause, which bypasses elements in a collection as long as a specified condition is true and then returns the remaining elements. Skip While Clause Describes the Where clause, which specifies a filtering condition for a query. Where Clause Describes the Take While clause, which includes elements in a collection as long as a specified condition is true and bypasses the remaining elements. Take While Describes the Take clause, which returns a specified number of contiguous elements from the start of a Collection Take Descriptions Clause Name
19. Queries – Order By Clause Specifies the sort order for a query result. Syntax: Order By orderExp1 [ Ascending | Descending ] [, orderExp2 [...] ] Example The following query expression uses a From clause to declare a range variable book for the books collection. The Order By clause sorts the query result by price in ascending order (the default). Books with the same price are sorted by title in ascending order. The Select clause selects only the Title property as the value returned by the query. Dim titlesAscendingPrice = From book In books Order By book.Price, book.Title Select book.Title, book.Price The following query expression uses the Order By clause to sort the query result by price in descending order. Books with the same price are sorted by title in ascending order. Dim titlesDescendingPrice = From book In books Order By book.Price Descending, book.Title _ Select book.Title, book.Price Dim bookOrders = From book In books Select book.Title, book.Price, book.PublishDate, book.Author _ Order By Author, Title, Price
20. Queries – Distinct By Clause Restricts the values of the current range variable to eliminate duplicate values in subsequent query clauses. You can use the Distinct clause to return a list of unique items. The Distinct clause causes the query to ignore duplicate query results. The Distinct clause applies to duplicate values for all return fields specified by the Select clause. If no Select clause is specified, the Distinct clause is applied to the range variable for the query identified in the From clause. If the range variable is not an immutable type, the query will only ignore a query result if all members of the type match an existing query result. Example The following query expression joins a list of customers and a list of customer orders. The Distinct clause is included to return a list of unique customer names and order dates. Dim customerOrders = From cust In customers, ord In orders _ Where cust.CustomerID = ord.CustomerID _ Select cust.CompanyName, ord.OrderDate Distinct
21. Queries – From Clause Specifies one or more range variables and a collection to query. Syntax: From element [ As type ] In collection [ _ ] [, element2 [ As type2 ] In collection2 [, ... ] ] Example: Dim customersForRegion = From cust In customers You can specify multiple From clauses in a query to identify multiple collections to be joined. When multiple collections are specified, they are iterated over independently, or you can join them if they are related. You can join collections implicitly by using the Select clause, or explicitly by using the Join or Group Join clauses. As an alternative, you can specify multiple range variables and collections in a single From clause, with each related range variable and collection separated from the others by a comma. The following code example shows both syntax options for the From clause.
22. Queries – From Clause Continue … ' Multiple From clauses in a query. Dim result = From var1 In collection1, var2 In collection2 ' Equivalent syntax with a single From clause. Dim result2 = From var1 In collection1 _ From var2 In collection2 The From clause defines the scope of a query, which is similar to the scope of a For loop. Therefore, each element range variable in the scope of a query must have a unique name. Because you can specify multiple From clauses for a query, subsequent From clauses can refer to range variables in the From clause, or they can refer to range variables in a previous From clause. For example, the following example shows a nested From clause where the collection in the second clause is based on a property of the range variable in the first clause. Dim allOrders = From cust In GetCustomerList() _ From ord In cust.Orders _ Select ord Dim customersForRegion = From cust In customers _ Where cust.Region = region
26. Queering Dataset Single Table Queries The following example gets all the online orders from the SalesOrderHeader table and outputs the order ID, order date, and order number to the console. ' Fill the DataSet. Dim ds As New DataSet() ds.Locale = CultureInfo.InvariantCulture ' See the FillDataSet method in the Loading Data Into a DataSet topic. FillDataSet(ds) Dim orders As DataTable = ds.Tables("SalesOrderHeader") Dim query = From order In orders.AsEnumerable() _ Where order.Field(Of Boolean)("OnlineOrderFlag") = True _ Select New With { _ .SalesOrderID = order.Field(Of Integer)("SalesOrderID"), _ .OrderDate = order.Field(Of DateTime)("OrderDate"), _ .SalesOrderNumber = order.Field(Of String)("SalesOrderNumber") _ } For Each onlineOrder In query Console.Write("Order ID: " & onlineOrder.SalesOrderID) Console.Write(" Order date: " & onlineOrder.OrderDate) Console.WriteLine(" Order number: " & onlineOrder.SalesOrderNumber) Next
27. Queering Dataset Accessing Values without using Field method Dim products As DataTable = ds.Tables("Product") Dim query = _ From product In products.AsEnumerable() _ Where product!Color IsNot DBNull.Value AndAlso product!Color = "Red" _ Select New With _ { _ .Name = product!Name, _ .ProductNumber = product!ProductNumber, _ .ListPrice = product!ListPrice _ } For Each product In query Console.WriteLine("Name: " & product.Name) Console.WriteLine("Product number: " & product.ProductNumber) Console.WriteLine("List price: $" & product.ListPrice & vbNewLine) Next
28. Queering Dataset Accessing Values using Field method Dim products As DataTable = ds.Tables("Product") Dim query = _ From product In products.AsEnumerable() _ Where product.Field(Of String)("Color") = "Red" _ Select New With _ { _ .Name = product.Field(Of String)("Name"), _ .ProductNumber = product.Field(Of String)("ProductNumber"), _ .ListPrice = product.Field(Of Decimal)("ListPrice") _ } For Each product In query Console.WriteLine("Name: " & product.Name) Console.WriteLine("Product number: " & product.ProductNumber) Console.WriteLine("List price: $ " & product.ListPrice & vbNewLine) Next
29. Queering Dataset Advantage of using Field method and SetField method The Field method provides access to the column values of a DataRow and the SetField sets column values in a DataRow . Both the Field method and SetField method handle nullable types, so you do not have to explicitly check for null values as in the previous example. Both methods are generic methods, also, so you do not have to cast the return type.
30. Queering Dataset Cross-Table Queries The Language-Integrated Query (LINQ) framework provides two join operators, Join and GroupJoin . These operators perform equi-joins: that is, joins that match two data sources only when their keys are equal. (By contrast, Transact-SQL supports join operators other than equals, such as the less than operator.) In relational database terms, Join implements an inner join. An inner join is a type of join in which only those objects that have a match in the opposite data set are returned. The GroupJoin operators have no direct equivalent in relational database terms; they implement a superset of inner joins and left outer joins. A left outer join is a join that returns each element of the first (left) collection, even if it has no correlated elements in the second collection.
31. Queering Dataset Cross-Table Queries Dim orders As DataTable = ds.Tables("SalesOrderHeader") Dim details As DataTable = ds.Tables("SalesOrderDetail") Dim query = _ From order In orders.AsEnumerable() _ Join detail In details.AsEnumerable() _ On order.Field(Of Integer)("SalesOrderID") Equals _ detail.Field(Of Integer)("SalesOrderID") _ Where order.Field(Of Boolean)("OnlineOrderFlag") = True And _ order.Field(Of DateTime)("OrderDate").Month = 8 _ Select New With _ { _ .SalesOrderID = order.Field(Of Integer)("SalesOrderID"), _ .SalesOrderDetailID = detail.Field(Of Integer)("SalesOrderDetailID"), _ .OrderDate = order.Field(Of DateTime)("OrderDate"), _ .ProductID = detail.Field(Of Integer)("ProductID") _ } For Each order In query Console.WriteLine(order.SalesOrderID & vbTab & _ order.SalesOrderDetailID & vbTab & _ order.OrderDate & vbTab & _ order.ProductID) Next
32. Queering Dataset Querying Typed DataSets A typed DataSet is a class that derives from a DataSet. As such, it inherits all the methods, events, and properties of a DataSet. Additionally, a typed DataSet provides strongly typed methods, events, and properties. This means you can access tables and columns by name, instead of using collection-based methods. Aside from the improved readability of the code, a typed DataSet also allows the Visual Studio .NET code editor to automatically complete lines as you type. Additionally, the strongly typed DataSet provides access to values as the correct type at compile time. With a strongly typed DataSet, type mismatch errors are caught when the code is compiled rather than at run time. Typed DataSets LINQ to DataSet also supports querying over a typed DataSet . With a typed DataSet , you do not have to use the generic Field method or SetField method to access column data. Property names are available at compile time because the type information is included in the DataSet . LINQ to DataSet provides access to column values as the correct type, so that type mismatch errors are caught when the code is compiled instead of at run time.
33. Queering Dataset Querying Typed DataSets Dim orders = ds.Tables("SalesOrderHeader") Dim query = _ From o In orders _ Where o.OnlineOrderFlag = True _ Select New {SalesOrderID := o.SalesOrderID, _ OrderDate := o.OrderDate, _ SalesOrderNumber := o.SalesOrderNumber} For Each Dim onlineOrder In query Console.WriteLine("{0}{1:d}{2}", _ onlineOrder.SalesOrderID, _ onlineOrder.OrderDate, _ onlineOrder.SalesOrderNumber) Next