blog.devbroker.org author="Patrick Rabian" about="c#, sharepoint, biztalk, team system resources" more="news, samples, tips for .NET world's developers !"

Using "Dynamic Data" with Entity Data model instead of Linq To Sql model

Sunday, 6 July 2008 01:48 by prabian

Previous versions of "Dynamic Data" were designed to use "LinqToSql".
With this service pack beta, you can use it with "Entity Data".

The "Context" type that must be declared is now "ObjectContext" instead of "Datacontext".

After having installed...
- .NET Framework 3.5 SP1 Beta
- Visual Studio 2008 SP1 Beta
(can be download here for .NET and here for VS)



...you can create a new project "Dynamic Data Entities Web Application".



Then you just have to :
- Create an "ADO.NET Entity Data Model" (for instance with the context class named "MyModelEntities") and insert one or more tables.



- Uncomment and change the specific line in "Global.asax.cs" :

model.RegisterContext(typeof(MyModelEntities), new ContextConfiguration() { ScaffoldAllTables = true });

- Launch the project

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Installing ADO Entity Framework Beta3 on Visual Studio 2008

Sunday, 17 February 2008 15:19 by prabian

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Installing Web Services Software Factory on Visual Studio2008

Sunday, 17 February 2008 15:06 by prabian

  • Install "GuidanceAutomationExtensions -  July 2007 CTP". Download it here (this version can be attached to VS 2005 or 2008 Orcas)
  • Install "Software Factory - Modeling Edition Feb 2008 CTP". Download it here (this version is attached to VS 2008)
  • Apply this fix to avoid the following error "Project Creation Failed" from Visual Studio 2008 while creating a new project. This is due to some assembly redirects that are added to the devenv.exe.config file by installing the GAX (Guidance Automation Extensions).
  • Open "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe.config" from notepad
  • Comment the line containing this string: "Microsoft.VisualStudio.TemplateWizardInterface"

      <dependentAssembly>
       
<!– <assemblyIdentity name="Microsoft.VisualStudio.TemplateWizardInterface" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> –>
        <bindingRedirect oldVersion="0.0.0.0-8.9.9.9" newVersion="9.0.0.0" />
      </dependentAssembly>

  • Close and re-open Visual Studio 2008, and try to create a new project

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:   ,
Categories:   .NET Projects | DAL | Developer Tools | doc | Learning | Sql
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Le requêtage universel

Wednesday, 30 August 2006 20:52 by prabian

Avec la nouvelle mouture de C# version 3 (ou VB.NET version 9), Microsoft annonçait il y a déjà quelques mois la venue de LINQ !
Pour rappel, LINQ est un langage orienté requêtes qui autorise notamment de procéder à des requêtes, non plus seulement sur des bases de données, mais également sur des structures XML ou encore des entités métiers. Ces différentes cibles sont appelées des « domaines de données ».
 
Ce principe n’a pas changé. Par contre, de nouveaux domaines de données sont apparus : LINQ to Dataset et LINQ to Entities.
 
Pour le second, la notion d’« Entities » réfèrent au concept de mapping O/R. Tout développeur produisant régulièrement des applications de gestion (exploitant des bases de données relationnelles) se pose la problématique de persistence (en l’occurrence, persistence des objects métiers dans une base relationnelle).
En principe, la persistence repose sur du mapping Objet/Relationnel (par exemple classe .NET mappé sur une table SQL Server).
A l’époque des annonces du Framework .NET 2.0, Microsoft prévoyait « Object Space », un module permettant de faciliter ce mapping. Or, ce projet a été annulé suite à la beta 1 et rien d’autre ne semblait se profiler. Et bien, avec LINQ to Entities, c’est chose faîte. Ce module va permettre de déplacer les traitements sur les données au niveau des objets métiers grâce à un système de mapping très poussé (d’après les dires de Microsoft !) et bien entendu du requêtage très puissant via LINQ. Donc, à suivre de près.
 
Pour illustration, voici à quoi ressemble une requête LINQ :
 
using System;
using System.Query;
using System.Collections.Generic;
 
class app
{
 static void Main()
{
string[] names = { "Burke", "Connor", "Frank", "Everett", "Albert", "George", "Harris", "David" };
 
IEnumerable<string> expr =
from s in names
where s.Length == 5
orderby s
select s.ToUpper();
 
foreach (string item in expr)
Console.WriteLine(item);
}
}
 
Finalement, les « domaines de données » actuels de LINQ sont les suivants :
            LINQ to DataSet
            LINQ to Entities
            LINQ to SQL (appelé DLinq)
            LINQ to XML (appelé XLinq)
            LINQ to Objects

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Oracle et .NET et plus encore !

Thursday, 17 August 2006 00:17 by prabian

Pour les utilisateurs de Oracle sous .NET 2.0, une nouvelle version du provider Oracle est sortie récemment.
Cette dernière se veut plus performante que celles proposées par Microsoft : System.Data.OracleClient, OLEDB for Oracle et bien évidemment ODBC…pour les 2 derniers, pas trop de doutes. Quand au 1er provider présent dans le namespace "System.Data.OracleClient" je vais prochainement procéder à quelques tests comparatifs et je tacherai de faire une synthèse sur les performances et les autres constats intéressants.

Le provider Oracle ODP.NET se trouve sur : http://www.oracle.com/technology/tech/windows/odpnet/index.html

Autre point intéressant, Oracle Developer Tools for Visual Studio .NET. A menu, des wizards pour se simplifier la vie lors du développement d’applications utilisant Oracle. Ma première install n’a pas été très concluante…plantage lors du lancement dans VS…mais je vais retenter rapidement ! A télécharger depuis : http://www.oracle.com/technology/tech/dotnet/tools/index.html

Enfin, Oracle Sql Developer arrive en release. J’avais cru entendre qu’il était soit disant censé contrer Toad…gloups…ce doit être une fausse information. Au delà de cette fausse idée, si l’on a besoin d’un client simple et léger (et gratuit !) pour naviger dans une base Oracle et utiliser les fonctionnalités essentielles (import, export, créer une table ou autre, …) …ça à l’air plutôt bien. Il y a notamment des "snippets" de code SQL bien pratique pour les trous de mémoire ou pour découvrir des optimisations.

Comme pour les autres, je creuse et je complète. Dispo sur : http://www.oracle.com/technology/products/database/sql_developer/index.html

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories:   Developer Tools | DAL | Sql
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Sql server 2005 Service pack 1

Saturday, 22 April 2006 22:20 by prabian

“Microsoft announces the availability of SQL Server 2005 Service Pack 1 (SP1) with Database Mirroring, SQL Server Management Studio Express, additional options for ISVs and normal feature fixes.”

Get more news and download from the url : http://www.microsoft.com/sql/sp1.mspx

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories:   DAL | Sql
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Get age from date of birth in Transact Sql

Monday, 12 December 2005 11:55 by prabian

Calculate the age of a person from his date of birth.

Parameters :

@dateNaissance = Date of birth
@dateActuelle = Current date (from GetDate())

CREATE FUNCTION [dbo].[fnGetAge] (@dateNaissance SMALLDATETIME, @dateActuelle SMALLDATETIME)
RETURNS INT AS
BEGIN
DECLARE @age INT
SET @age = FLOOR(DateDiff(dd,@dateNaissance,@dateActuelle)/365.25)

IF (Day(@dateNaissance) = Day(@dateActuelle)) AND (Month(@dateNaissance) = Month(@dateActuelle))
   BEGIN
      SET @age = @age + 1
   END

RETURN @age
END

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories:   DAL | Sql
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed