Category Archives: Clarion.Net

Clarion T4 template walk-through

T4 templates have a simple ASP.NET-like syntax and consist of processing directives, text blocks and code blocks. For this discussion we’re using the attached DCTTreeWizard.tt file which is a Utility template. Download it from here

We have two types of Utility Templates; DCT Utility Templates and ApplicationUtility Templates. Within the IDE when the “Document” tab that has focus is a .DCT or an .APPX the “Run Utility Template” menu item under the File menu is enabled, and depending on the type of the active document, the “Run Utility Template” Menu item will show a Selection Dialog displaying the appropriate Utility Templates for the document (DCT Utility Templates or Application Utility Templates) The big difference between a standard template and a Utility Template, is that the when the Utility Template is executed, the code will not output any text/code automatically. The template developer must define the output using the built-in Open/Close or Create/Close methods.

The DCT Utility template focuses on the DataDictionary object. The DataDictionary object is of type IDataDictionary, and using the IDE’s code completion we can learn how to use it; seeing its properties and methods with the complete descriptions. The DataDictionary object is very straight forward and easy to undertand. For example, it’s likely pretty clear that “this.DataDictionary.Tables” returns all the tables defined in the Dictionary.

The Application Utility template also has the DataDictionary object, but it has another object called “Application”. And of course you can query “this.Application.Procedures”, and guess what that returns? Yes you guessed it, all the procedures defined in that .APPX file.

Let’s do a walk-through of our simple DCT Utility template.

We’ll start with a look at Directives. The syntax of a directive is:

<#@ DirectiveName [ParameterName = “ParameterValue”] #>

for an example look at line 1 from the attached template:

<#@ template language=”C#” debug=”true” type=”Utility” name = “DCTTreeWizard” chain=”Clarion.File”#>

The “language” parameter specifies which language is used in the code blocks of the template, and in this case we specify C#.

The “debug” paramater allows you to debug templates. When that parameter is on, and the corresponding IDE option is also on, the template source code files are copied to the %root%..Templatesdotnet folder. And when there is an error in compiling the template (compilation occurs when you register the template), the error is displayed in the Error pad, and you can then double-click on the error and the .TT file with the error is opened for editing at the line with the error.

The “type” parameter specifies the type of template, current possible types are:
Application,
Procedure,
ApplicationExtension,
ProcedureExtension,
Utility,
UtilityApplication,
WizardApplication,
WizardProcedure

The “name” parameter assigns a name to this template, and finally the “chain” parameter specifies the template family.

Lines 2-6 use the “assembly” directive:
<#@ assembly name=”mscorlib.dll” #>
<#@ assembly name=”System.dll” #>
<#@ assembly name=”System.Drawing.dll” #>
<#@ assembly name=”System.Design.dll” #>
<#@ assembly name=”System.Drawing.Design.dll” #>

The “assembly” directive identifies an assembly to be referenced by the template so that you can use types within that assembly from within the code in your template. Using the assembly directive is equivalent to using the Add Reference feature in the Clarion# IDE. The “assembly” directive does not affect the source code of the compiled template.

Lines 7-12 use the “import” directive.
<#@ import namespace=”System.Collections.Generic” #>
<#@ import namespace=”System” #>
<#@ import namespace=”SoftVelocity.TextTemplating” #>
<#@ import namespace=”System.Drawing” #>
<#@ import namespace=”System.Drawing.Design” #>
<#@ import namespace=”SoftVelocity.DataDictionary.Design” #>

The import directive allows you to refer to types within a text template without providing a fully qualified name. The “namespace” parameter is transformed into a .Net “using” directive in the compiled template.

Now look at line 13:
<#@ property processor=”PropertyProcessor” name=”OutputFile” type=”System.String” defaultValue=”none” editor=”System.Windows.Forms.Design.FileNameEditor”#>

The “property” directive defines an editable property of the template. It corresponds to #PROMPT in our Win32 template language. The parameters are probably self-explanatory; “name” is the name that is displayed in the property grid, “type” defines what type of value is accepted, “defaultValue” is exactly as the name suggests, and “editor” is the object that is used to visually edit the property. The “editor” can be just the default; a simple text string, but it can also be a dialog window, a dropList, a checkbox, or by default a simple textBox.

Line 14 is interesting: <#+ string _OutputFile = “”;#>

the <#+ tag indicates a template helper block. The helper block allows the template developer to add code at the TextTransformation Class level. The code added can be a Method, a Field, or a Property declaration.

If a Method is declared within the helper block, it can be compared to a #GROUP from our Win32 template language. Embeds can also be declared inside a helper block.

for example:

<#+ void MyPseudoGroup() {#> <#% MyEmbed #> <#+}#>

In this case when the method MyPseudoGroup is called, the content of the MyEmbed will be also executed.

Line 15: <# this._OutputFile = this.OutputFile;#>

just the value set in the “OutputFile” within the property directive to the internal _OutputFile variable.

Line 16: <# Create(this._OutputFile);#>

calls an internal method that creates a file on disk to receive the generated text (code or other text). It corresponds to our Win32 counterpart #CREATE.

Line 17:
*************************

is a text block, as there are no template directives surrounding it. Text blocks are copied to the output “as is”, with no further processing.

Line 18: – Listing for Dictionary: <#= this.DataDictionary.FileName #>

mixes a text block: ‘– Listing for Dictionary: ‘ with an expression block:
<#= this.DataDictionary.FileName #>

You use expression blocks in text templates to add strings to the generated text output. In this case we’re asking for the name of the Dictionary that we’re processing. Expression blocks are delineated by using the <#= template tag. The syntax is: <#= ExpressionCode #>

Lines 19-49 use code blocks. The syntax for a code block is: <# Code block #>

Code blocks can generate template output. In our template the code block uses a few nested foreach loops to walk the dictionary. We’re using a mix of text blocks and expression blocks to write the details of the dictionary to the output file. Code blocks can use any available .NET APIs. In this template we’re using the DataDictionary API to output the Dictionaries collections and properties; Tables, Columns, Keys and Relationships.

I hope this walk-through has provided a good introduction to the new template syntax used in AppGen.Net.  For those who are thinking of writing some T4 templates the attached example is a good starting point to get familiar with the essentials. Next time we’ll go a bit deeper into the template syntax.

.Net Application Generator

In this post I’ll try to provide a complete overview and our best estimate on when you’ll have this new technology in your own hands. Diego Borojovich is leading the team working on the new .Net Application Generator (AppGen.Net), and if you have attended any DevCon events over these last years then you probably have met Diego. He’s been working with Clarion for over 16 years, and joined the SoftVelocity development team 8 years ago. You’ll be hearing a lot more from Diego in blog posts in the upcoming weeks as he talks in-depth about the new AppGen.Net, the template language, and how the new code generation/template system works.

Let’s start from the top; the Code Generation engine in AppGen.Net is completely new. It has its architectural and conceptual roots in the Clarion Win32 AppGen, and that technology is blended with the functionality found in the Text Template Transformation Toolkit (T4).

The template language used in the new AppGen.Net is a complete departure from the syntax used by the templates in our Win32 Application Generator.  It uses an extended set of the T4 template directives. It’s very easy to work with the template code and templates can be used in any type of project (WinForm, WebForm, CompactForms, Web Services, etc.). And just like with our Win32 AppGen you can write templates to create any type of output that you need – CLN, CS, ASPX, HTML, SQL, XML, or anything else you need.

The syntax for the new templates is similar to what you see in an ASP.NET .ASPX source file – here’s a small snippet so that you get a feel for what it looks like:

<#@ template language=”C#” debug=”true” type=”ProcedureExtension” name = “DescriptionOutput” family = “Clarion.Linq”#>
<#@ assembly name=”mscorlib.dll” #>
<#@ assembly name=”System.dll” #>
<#@ import namespace=”System” #>
<#@ import namespace=”SoftVelocity.TextTemplating” #>
<#@ property processor=”PropertyProcessor” name=”MyDescription” type=”System.String” defaultValue=”None”#>
<#%+ CustomGlobalData priority = “1000”#>

I already mentioned that the AppGen.Net template system supports an extended set of the T4 template directives, these extended directives include equivalence for our #PROCEDURE, #CODE, #GROUP, #CONTROL, #EMBED and #AT and #EXTENSION directives as found in our Win32 template system. And you may have noticed in the first line of the template snippet where it reads “template language=C#”? In the first release, all the templates are coded in C#, but in a future release we plan to let you use any .Net language to write your own templates. The templates themselves can utilize the entire .Net Framework, including any 3rd party components, and that gives us (and you) incredible power and flexibility in the template system; meaning there are really no limits to what you can do in a template (outside of is your own imagination). If you plan on writing templates you’ll be glad to know that inside the IDE we already have T4 syntax highlighting in the editor, and in the near future we’ll be adding code completion support.

The template system has the concept of a template registry, just as we have now. But with AppGen.Net when templates are registered into the IDE they are automatically compiled into a binary assembly. Compiling the templates provides for faster code generation, immediate detection of syntax errors, and makes it easy to share templates within a team.

In the initial public release the generated data access layer will let you select from two data access frameworks; LINQ to File, and LINQ to SQL.  (It’s possible that we will also provide a template set for generating a plain ADO.NET data access)

What is LINQ to FILE?

LINQ to FILE utilizes our own LINQ provider that encapsulates an ABC-styled framework — using LINQ syntax for accessing and updating data via our underlying File Driver technology. The LINQ to FILE provider maintains referential integrity and also handles auto incrementing of keys. The LINQ to File data access layer can also utilize our managed .Net IP driver. If you’re not already familiar with LINQ syntax here is a simple example of the syntax used for retrieving data:

query? = from class in ClassesQuery    |
where class.RoomNumber < 10   |
select class

This LINQ query will retrieve all records where the column RoomNumber is less then 10, it’s really that simple. And using a LINQ query with a Where clause instead of filtering records in a Loop provides a noticeable increase in performance. Using the LINQ to File lets us work with powerful SQL-like query and update capabilities, working with all of our FILE Drivers, and integrated into the LINQ to FILE provider is functionality essentially equivalent to that in our existing ABC framework.

What Is LINQ to SQL?

LINQ to SQL is itself a light-weight ORM (object relational mapping) implementation that ships as part of .NET 3.5, that allows you to model a relational database using .NET classes.  You can then query the database using LINQ, as well as update/insert/delete data from it. LINQ to SQL supports transactions, views, and stored procedures.  The templates provide an easy way to integrate data validation and business logic rules directly into your data model.

In addition to the two LINQ frameworks we plan to add template support for working with several additional technologies for the data access layer;  options for data access will look like this:

•    LINQtoFile
•    LINQtoSQL
•    ASP.NET MVC
•    NHibernate
•    CSLA
•    ADO.Net

We also plan to have templates for supporting these technologies:

•    Windows Communication Foundation (WCF) is the .Net programming model for building service-oriented applications.
•    Web Services (for exchanging data)

And I should mention that we’re providing template sets to support the three target platforms; Winforms (desktop), WebForms (Web) and Compact Forms (Mobile devices). The templates being developed for .Net offer code generation in 2 language flavors C# and Clarion#, and eventually we’ll add VB to the list.

I want to mention a few things about the user interface generated by the templates. These are options that the templates will provide for the user interface layer:

•    Winforms (using the standard .Net Framework controls, or a designated 3rd party component set)
•    CompactForms (using the standard .Net Framework controls, or a designated 3rd party component set)
•    Webforms (using the standard .Net Framework controls, designated 3rd party component set, Ajax Library, and in the future Silverlight)
•    WPF – Windows Presentation Foundation: (using the standard .Net Framework controls, or a designated 3rd party component set)
(The WPF support will come after the initial release, and although we don’t presently have a full-blown designer, we will have UI edit capabilities, and of course you can use many different external tools to create and work on the UI as the code is completely separate from the other layers)

For creation of the UI the templates read the control settings from the Dictionary, just as we do now in the Win32 AppGen, but we plan to provide (as a configuration option) the ability to specify that the templates use an external file for control mappings, and in this file we’ll store the fully-qualified name of the control, along with its properties (i.e. font, width, height, etc.). The controls specified in the config file will map back to the controls supported in the templates for generating the UI. This feature means that you can specify the use of 3rd party components and the Template Wizards will generate the UI using those controls and properties.

Here are a few miscellaneous new features that are worthy of mention which are planned to be introduced with the new AppGen.Net:

•    Option to generate test cases (nUnit) for aspects of the APP
•    Ability to attach developer documentation/working notes directly into the .APP and/or to individual procedures

And something else exciting is coming up; we are happy to announce that the templates to power these technologies will be made part of an open collaborative community project so that anyone interested can participate in their ongoing development. This collaborative project will contain all of the new Clarion templates and sample Apps.

And this project is not just for the new .Net templates, we’ll be adding all of our Clarion templates (Win32 and .Net), as well as new example Apps. With this project the Clarion community will always have access to the very latest updates, as well as contribute patches, and add new templates and sample Apps.

Now the question at hand is when will you get it?  We have had to revise our earlier estimates to allow extra time for some of the integration tasks in our switch over to the new AppGen.Net, and the revised estimate for delivering a full beta is now about 5-6 weeks from today, putting it into a late-May early-June time frame. However, it is very likely that we’ll release the new AppGen.Net with some reduced template support before that. That first early release will support generation of code targeted at the data access layer, in other words it will be without the tie-in with the Designers. And that release also will likely include Application and Procedure Wizard functionality. So that first release will provide a big increase in productivity in two areas, and it’ll also allow those who are interested, to start working on the template code itself. Very importantly it’ll also let us get feedback from you on the AppGen.Net UI itself, which is very valuable to us all.

Clarion.Net updates

We have a new update on its way to you.  This release solidifies the new LinqToFileProvider and has some good general fixes. We’re getting closer with the new App code generator and we will keep you posted on how its progressing.  We’re also getting close to where we’ll open up weekly or bi-weekly internal builds.

Product downloads and access to Internal builds

We’ve received some requests via email that have prompted us to start a new project this week; a secured website membership component. We have two goals to accomplish; first we’ll provide the ability to log in to our website and download products that you own, retrieve serial numbers for same, and get the newest updates to the Help files, and second you’ll be able to log in and have access to pre-release internal builds. We’ll make internal builds available for both Clarion 7 (Win32) and Clarion# (.Net). We have started the work on an implementation of a website membership project to be built on top of ASP.NET’s SQLmembership Provider with the UI built with AJAX. We’ll be using it to control the access to the product downloads and to the internal builds, and we’ll also be shipping the secured website membership component as source code with Clarion.Net (and of course we’ll be using it with the .Net App generator).

Access to internal builds will be open to anyone with a current subscription. Once the project is launched we’ll initially try to make internal builds available on a bi-weekly basis (weekly builds are also a possibility). You’ll have access to the change log, and if you see a fix or a feature become available that’s important to you – you’ll have the option to download the corresponding internal build. And by the way, if there happens to be a change to the RTL or compiler that would require your 3rd party tools be rebuilt (this is a fairly rare occurrence), it’ll be duly noted in the change log.

We’ll also be increasing the frequency of publishing maintenance releases (this too was requested in several emails), and we expect to make a new 7.1.x release available at the end of this week.

32 bit ODBC in the 64-bit Operating System

Note: This blog was written by Robert Ricketts, who is a Senior Support Representative at SoftVelocity. If you have any questions, you can post them here or even email us at support AT softvelocity DOT com

Now, on to the article! 🙂

There has been quite a bit of confusion about using the 32 ODBC Administrator and 32 Bit ODBC drivers in 64 bit Operating Systems so I thought I would put together some information to help when using 32 bit ODBC drivers, such as the TopSpeed ODBC driver.

For 64 bit Operating Systems, there is a 64 bit and a 32 bit ODBC Source
Administrator.  Both actually have the same name (odbcad32.exe).

You can launch the Admin applet from the command line (or a Shortcut) so you get the 32-bit version of the ODBC configuration tool. The command line is as follows:

%WINDIR%SysWOW64odbcad32.exe

Microsoft stores the 32 bit odbcad32.exe in the syswow64 directory and the 64 bit odbcad32.exe in the system32 directory.

N.B. If you just run odbcad32.exe, Windows will actually run the 64-bit version because the default system path has system32 ahead of syswow64.

From: http://support.microsoft.com/kb/942976

System DSNs are stored in the following registry subkey:
HKEY_LOCAL_MACHINESoftwareODBCODBC.INI

Registry redirection is enabled for this registry subkey. Therefore, system
DSNs for 32-bit drivers and for 64-bit drivers are separated. The 64-bit ODBC Administrator tool does not display the system DSNs that are created by the 32-bit ODBC Administrator tool or that use 32-bit drivers and visa versa.

User DSNs are stored in the following registry subkey:
HKEY_CURRENT_USERSoftwareODBCODBC.INI

Registry redirection is not enabled for this registry subkey. Therefore, both
ODBC Administrator tools display all user DSNs.

Regarding the DotNet Framework

In order to use the TPS ODBC driver from .NET you will need to use the .NET Framework Provider for ODBC.

If you see no reference to the .Net Framework Provider for ODBC, this is
available as a free download from:

http://www.microsoft.com/downloads

Search for “ODBC .Net Data Provider” to download and install the .Net Framework Provider for ODBC.

A Whale of a Time!

I woke up this morning and suddenly realized that in two weeks I will be flying back to Eden in New South Wales for the 2009 Aussie Devcon!

I can’t wait to get back there and feel honored to showing you what we’ve been cooking over the last few months.

If you haven’t booked your seat at the conference yet, please visit the Aussie DevCon web site and reserve your place, as the time is fast approaching.  Here is the link to get started:

http://clarion.net.au/

You’ve got to be there! The progress and maturity of both Clarion 7 and the Clarion.NET products have been significant and dramatic in many areas since last year’s Aussie DevCon. Last year, Clarion 7 was in beta, and the Application Generator was still in its early stages. Today, we are just around the corner for Clarion 7.1, and the Application Generator is better than it’s ever been, including our past versions. I will be using Clarion 7.1 exclusively during the training and conference, and we hope that all of you will have it by then as well.

The training this year is titled “Exceptional Development Techniques in Clarion 7 and Clarion.NET”

With the many months of working with Clarion 7, I will be covering many topics that have been of major interest to our developers. One of the topics will be an in-depth look at the C7 Project System and leveraging it for maximum productivity for your single and multi-application projects.

Of course, I will be highlighting Version 7.1, and all of the new features and changes in it. We will be exploring the heart of application development with an in depth look at the Dictionary Editor and Application Generator, and explore development techniques and solutions via the template and embeds that you may have missed.

I will also be giving you a first look at the new ReportWriter, and hopefully you will see why I am so excited about this new addition to Clarion 7 and Clarion.NET.

Many of you have an interest in the triumverat of add-on products for Clarion 7, the In-Memory, Dynamic File, and Internet Protocol drivers, and we will devote a section of training to using these products in your development solutions.

I could go on, but see the full training and conference schedule for yourself at the following link:

http://clarion.net.au/index.php?option=com_content&task=view&id=33&Itemid=35

My colleague, Pierre Tremblay, will also be a presenter at the conference and training. Pierre has been using Clarion for almost as many years as I have, and his experience with .NET development has given him a powerful perspective and vision in presenting the latest Clarion.NET IDE.

 

Here are some comments from Pierre, and what he has planned for the conference and training.

Aussie Devcon 2009 is a real excitement for me! I have the privilege of presenting Clarion.NET WinForm and WebForm related topics during the conference and training.

Here are highlights of what we will discuss.

Regarding Clarion.NET and Winforms, we will talk about what is a WinForm application and look at the most popular controls used to build the user interface.  We will also talk about the Clarion.NET language and explore events, delegates, interfaces and look at examples using them. We tend to associate events with a user interface, but events in Clarion.NET are a different paradigm, and we will examine an example of that.

Speaking of user interfaces, we will also discover the benefits of using a UserControl in a WinForm application.

We will also discuss data binding. When you hear “data binding”, we often associate “data” with “database”, but you will see that data in data binding is different and much more generic.

We will look at the building blocks of ADO.NET. This includes a look at Datasets, DataTables and the role of the DataTableAdapter.

On the ASP.NET side of my presentation and training, we will first get in touch with AJAX. We will understand why most new projects involving ASP.NET those days involves AJAX. AJAX is so popular that it is now a built-in assembly in the 3.5 .NET  Framework.

We will explore ASP.NET master and content pages to see how we can develop a standard look and feel in our web applications.

We will also examine WebServices, how to create them and how to consume them.

Finally, there is a segment showing how to incorporate a 3rd party control library in the IDE. We will explore the steps to achieve that and we will also look at how we can create a QuickStart template that automatically includes the new library.

Our CEO, Robert Zaunere, will also be back for this year’s conference. Robert has some very exciting news and information to present at the conference. At the forefront is the first look at the Code Generation model for Clarion.NET. He will explain the architecture of the new templates, as well as demonstrate the application generation process. Another topic that he will be presenting is the new Clarion support for LINQ (Language-Integrated Queries).

***********************************

If that’s not enough, some of you might wonder why the conference was scheduled in October this year instead of the previous May. The answer is that the conference is being held right in the middle of Whale Watching season. Geoff Spillane has organized a very special Whale Watching Cruise for the morning of Friday 16th October. For those who attend both Training and Convention (the full 7 days) they will qualify for participation in the cruise for free. How cool is that?

***********************************

So hpefully now you know why Pierre and I are excited about Aussie DevCon 2009. Come and see what a great product Clarion 7 and Clarion.NET really is, and even greater are some of the developers that will be there. I am looking forward to meeting some of you for the first time, and for the warm reunion ahead for those of you that I met last year.

We hope to see all of you there!

LINQ to FILE Provider

Language Integrated Query (or LINQ, pronounced “link” for short), is a set of .NET technologies that provide built-in language querying functionality similar to SQL, not only for database access, but for accessing data from just about any source.  Simply put LINQ is a set of language changes and API’s that allow you to write SQL-like queries natively in your chosen .NET programming language. LINQ provides the same query model and operators for different data sources, such as LINQ to Objects, LINQ to XML, LINQ to SQL and now our new LINQ to FILE provider.  And LINQ isn’t limited to traditional data sources, there are many more LINQ to “xyz”  providers, for example here is a list of some non-typical LINQ providers;

  • LINQ to WebQueries by Hartmut Maennel handles searches in the SiteSeer and MSDN Web sites.
  • LINQ to Amazon by Fabrice Marguerie, a co-author of the LINQ in Action book. LINQ to Amazon returns lists of books meeting specific criteria.
  • LINQ to Flickr by Mohammed Hossam El-Din (Bashmohandes) uses the open-source FlickrNet C# library as its infrastructure.
  • LINQ to Google Desktop supports queries to the Google desktop search engine

and the full list of available providers is much longer, if you’re interested in seeing more LINQ providers follow this link

Part of the beauty of  LINQ is that the exact same syntax is used to query (and potentially update) any data source that implements IEnumerable.  LINQ defines a set of general purpose standard query operators that allow for traversal, filtering, and projection operations to be expressed in a direct, yet declarative way in any .NET-based programming language.  Let’s take a look at it in some Clarion# code using the new LINQ to FILE provider:

In the data declaration section you declare IFileQuery instances of a file’s record type:
!  ——Data declaration section——
ClassesQuery            IFileQuery<Classes.Record>
CoursesQuery            IfileQuery<Courses.Record>

CODE
myQuery? = from class in ClassesQuery |
where class.RoomNumber < 10 |
select class

The local variable myQuery? is initialized with a query expression. A query expression operates on one (or more) information sources by applying one or more query operators from either the standard query operators or any domain-specific operators.  This expression uses two of the standard query operators: Where, and Select, and its very obvious this query will return all records where the the RoomNumber column has a value < 10.

The arguments to the Where and Select operators are called lambda expressions, which are essentially fragments of code. They allow the standard query operators to be defined individually as methods and strung together, and these methods form the basis for an extensible query language.

Lambda expressions are one important piece of the LINQ query architecture. Extension methods are the other. Extension methods combine the flexibility of dynamic languages with the performance and compile-time validation of statically-typed languages. We’ll delve into extension methods in another post.

Let’s look at another example:

myQuery? = From class in ClassesQuery |
Where class.RoomNumber < 10 |
OrderBy class.ClassNumber, class.CourseNumber Descending |
Select New {class.ClassNumber, class.CourseNumber, |
class.RoomNumber}

This query introduces the OrderBy and Select New operators. If you’ve had any exposure to SQL then this is very easy to understand, and even if you have no SQL experience its still easy to see what this query will return; a sequence of data objects where roomNumber is < 10, ordered by Class/Course numbers descending. What isn’t obvious is that “Select New” is only returning the class.ClassNumber, class.CourseNumber, and  class.RoomNumber columns.

There are many more features provided for in the new LINQ to FILE provider, here is a complete list of operators that the LINQ to File provider implements:

  • Where
  • Select
  • SelectMany
  • OrderBy/OrderByDescending
  • ThenBy/ThenByDescending
  • GroupBy
  • Join (inner)
  • GroupJoin (left)
  • Sum
  • Average
  • Min/Max
  • Count/LongCount
  • DefaultIfEmpty (usually used to provide “flat” left join)
  • Skip
  • Take
  • First/FirstOrDefault
  • Last/LastOrDefault
  • ElementAt/ElementAtOrDefault
  • Single/SingleOrDefault
  • TakeWhile
  • SkipWhile

Certainly you can already write your own code and define your own Views to provide the same  functionality, but with LINQ you don’t have to.  Besides a very simple and elegant syntax, the LINQ To FILE Provider is fast.  In our testing comparing the LINQ to FILE Provider to our plain LINQ to FILE, and to a standard VIEW structure, the tests showed the LINQ to FILE Provider was often more then twice as fast as a standard VIEW, and it always provided at least equivalent performance..

If all the LINQ to FILE Provider did was implement great query functionality it would be very powerful and very useful.  But it does much more, under the covers it implements equivalent functionality to the ABC library, except in this case its a managed code equivalent to the ABC library functionality. In a future article we’ll take a look at how we work with auto-incrementing, Insert/Update and Delete(s), and maintaining RI relations using the new LINQ to FILE Provider.

LINQ-style data access is available for all 3 .Net platforms (Winform, WebForm and Mobile). LINQ in general, and the new LINQ to FILE provider are key parts to the new templates for .Net code generation. And while you won’t need to write LINQ queries, (you’ll construct them visually and the templates will generate Dictionary related RI/AutoInc/CRUD statements for you) its still nice to know how easy it will be to create your own queries.

I’ll be doing a couple sessions on LINQ-style data access and the new LINQ to FILE provider at the upcoming Aussie DevCon, and I’ll be demonstrating how this technology fits into our code generation architecture using the new .Net templates.

Precompile and Publish ASP.Net web apps

We’ve added some new functionality to the IDE in support for precompling and publishing a web app.  As you know by default, ASP.NET dynamically parses and compiles any ASPX page when the first request is made for the page. The .Net runtime caches the compilation outputs and does not need to recompile again unless someone edits a file. This behavior brings us a good amount of flexibility, including the flexibility to change code and markup. and instantly see the changes reflected in the next browser request.  ASP.NET 2.0 introduced the option of precompiling your website. Precompling offers the following advantages :

  • You do not need to deploy the source code to the server. The website is precompiled into binaries, which are then deployed to the server.
  • It allows you to identify any bugs during compilation rather then opening each page
  • The deployment process is a bit easier as all your aspx pages, user controls etc. are compiled into binaries.There are a few different ways you can precompile a website.
Precompiling websites at the command-line

When you have an ASP.Net project open the IDE command “Build” only validates the project and puts the assemblies into the ASP.NET temporary folder.

The values you enter on the new MSBuild tab of the Propect Properties are valid if you want to build the project from the command line. So at a command prompt you use this syntax:

MSBuild <projectfile>.aspxproj /target:Msbuild /property:ClaNetBinPath=<Clarion.Net BIN folder>

aspprocomp

Precompile and publish websites using the Clarion IDE

To precompile and publish your website using the IDE follow these steps:

1. Open your website project
2. In the Solution Explorer right-click on the Project and from the context menu choose “Publish Web Site”

asp1

3. You then get a Publish Web Site dialog like shown below where you can specify the path to publish. Clicking on the eplisis(…) lets you choose a folder.

asp2
4. Select your options in the dialog :

a. Allow this precompiled site to be updatable – This option allows you to change the markup and client side functionality of the .aspx pages.
b. Use Fixed Naming And Single Page Assemblies
c. Enable strong naming on precompiled assemblies – specifies that your assemblies are strong named using a key file or container.

5. Click Ok to compile and publish the website. Continue reading Precompile and Publish ASP.Net web apps

Report Writer for 7.1

During the webinar on ClarionLive covering Report Writer we had some great suggestions for additional features and functionality.  It would be helpful if the Clarion devs who voiced those ideas could open Feature Requests in the PTSS  system so we can properly track them.  If you’d like to vote your support for a particular feature request you can also post a comment right here.

There were some audio problems during the webinar and it seems it caused some confusion during the Q/A session. It seems the most confusion revolved around whether the ability to just print/preview a report from within a Clarion7 or Clarion.Net application would require a license per workstation, this is the same type functionality as we have now using the C70prlbx.dll, and the answer is No, there is no license required to view and print exisitng reports.  We’ll be providing the same type of functionality as in C6/C7 to easily print/preview exising reports (without the full Report Writer) but with greater depth in order to take advantage of new features and functionality.

Managed IP Driver

The current public version of Clarion.Net has support for all of the core Clarion drivers available for Clarion Win32. You can use the drivers for developing desktop and web apps, but they can’t be used on Mobile Devices due to the different CPUs used on those devices.  To accomplish this the runtime uses interop to access the native win32 functions. This works seamlessly and there are some amazing benefits for Clarion developers who can leverage all their database driver knowledge, run .Net and win32 Clarion programs side by side, and much more.

But up until now those native calls into the driver layer meant that on a 64bit OS you needed to run your Clarion# application targeting an x86 CPU. Otherwise the JIT compiler would compile the application as 64bit and when the runtime tried to make a call into the native win32 driver layer it would fail.  Changing the applications target CPU or just running the corflags.exe is simple and takes just a few seconds (the corflags tool allows you to configure the “CorFlags” section of the header of an assembly), but now you have another choice; the managed IP Driver.

The managed IP Driver is exactly what the name implies, its a 100% managed code implementation of our IP Driver. This means a few things;

  1. you can build WinForm applications that access any of the database formats that Clarion supports
  2. you can build WebForm applications that access any of the database formats that Clarion supports
  3. you can build CompactForm applications (Mobile devices) that access any of the database formats that Clarion supports

For item (1) in the list above you might be thinking “but I already can do that”, which is true but now your application can run as a pure managed code 64bit application. You might be thinking the same about item (2), but two things are worth mentioning; anyone who has ever tried to run a web application under IIS that reads/writes non-SQL database files knows the hoops that have to be jumped thru to make IIS security cooperate, and secondly if IIS is running on a 64bit OS, its going to want to run 64bit web applications. Now you can force 64bit IIS to run a web app that requires access to a native 32bit binary, but its not pretty and its not particularly easy. Point number (3) is potentially huge because it means that any Clarion# mobile application now has another data storage option besides SQL and XML. Mobile applications can now use Clarion file I/O syntax and can access any database that Clarion supports. Naturally this access requires a network connected Mobile device.

This is all accomplished with separate versions of the Clarion.Net runtime assemblies. If you set the checkbox shown below your application automatically references these new runtime assemblies:

managedip
The managed IP driver will be supported for both Professional and Enterprise editions.