Leonardo
Leonardo

Reputation: 1

How can I convert this code LINQ to SQL in C # LINQ to SQL in Vb.net

How can I convert this code LINQ to SQL in C # LINQ to SQL in Vb.net

    public IQueryable<Maestro_Clientes> GetMaestro_Clientes()
    {
        var q = from co in this.Context.Cli_Consumos
            group co by new
            {
                Servicio = co.Servicio,
                Cliente = co.Cli_Servicio.Cli_Cliente.Nombre ,
                Tarifa = co.Cli_Servicio.Cli_Tarifa.Descripcion ,
                Sector = co.Cli_Servicio.Sector,
                Sector_Nombre = co.Cli_Servicio.Cli_Sector.Descripcion 
            }

            into grp
                select new Maestro_Clientes
                {
                    Servicio = grp.Key.Servicio,
                    Nombre = grp.Key.Cliente,
                    Tarifa = grp.Key.Tarifa,
                    Sector = grp.Key.Sector,
                    Sector_Nombre = grp.Key.Sector_Nombre,
                    Consumo_Energia = grp.Sum(co => co.Consumo_Energia)
                };

        return q;
    }

Telerik and Developer Fusion not convert well

Upvotes: 0

Views: 1218

Answers (2)

pete_s
pete_s

Reputation: 41

Try SharpDevelop's CodeConverter. It works best if you give it a whole function or class.

Upvotes: 0

Matthew Sposato
Matthew Sposato

Reputation: 1635

Have you tried any of the online converters? i.e. Developer Fusion or Telerik

Upvotes: 1

Related Questions