IMPORTANTE:
Agregar este using:
using System.Xml.XPath;
XDocument xmlDoc;
xmlDoc = XDocument.Load("Data.xml");
/* coleccion de elementos dentro de un determinado path */
var destinos = xmlDoc.XPathSelectElements("publicador/configuracion/destinos/web");
foreach (var dest in destinos.Elements("destino"))
{
Console.WriteLine(dest.Value);
}
/* coleccion de elementos cuyo valor contiene un texto específico */
var x = xmlDoc.XPathSelectElement("publicador/aplicaciones/aplicacion/nombre[text()='abc']");
Ejecutar un stored procedure con XML como parametro en Sql Server
Tabla
USE [base]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Empresa](
[Id] [numeric](18, 0) NOT NULL,
[Nombre] [varchar](50) NULL,
[Direccion] [varchar](50) NULL,
CONSTRAINT [PK_Empresa] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
Stored procedure
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE Prueba
@DatosXml XML
AS
BEGIN
SET NOCOUNT ON;
insert into Empresa (Id, Nombre, Direccion)
SELECT
Pers.value('(Id)[1]', 'int') as 'Id',
Pers.value('(Nombre)[1]', 'Varchar(50)') as 'Nombre',
Pers.value('(Direccion)[1]', 'varchar(50)') as 'Direccion'
FROM
@DatosXml.nodes('/Empresa/Persona') as EMP(Pers)
END
GO
Ejecucion
exec Prueba @DatosXml = '<Empresa> <Persona> <Id>1</Id> <Nombre>Pedro</Nombre> <Direccion>Dir 1</Direccion> </Persona> <Persona> <Id>2</Id> <Nombre>Juan</Nombre> <Direccion>Dir 2</Direccion> </Persona> </Empresa>'
No se puede hacer debug, no entra en los metodos o no se detiene en los breakpoints
PASO 1:
1) Eliminar el archivo .suo
2) hacer clean del proyecto y luego arrancarlo con F10
PASO 2:
Tools / Options / Debugging / Symbols
En "Cache symbols in this directory" agregar el path del archivo .pdb de la solucion.
Ej:
C:\<ruta>\bin\Debug
PASO 3:
1) make sure all projects are using the same Framework (this is crucial!)
2) in Tools/Options>Debugging>General make sure "Enable Just My Code (Managed Only) is NOT ticked
3) in Tools/Options>Debugging>Symbols clear any cached symbols, untick and delete all folder locations under the "Symbols file (.pdb) locations" listbox except the default "Microsoft Symbol Servers" but still untick it too. Also delete any static paths in the "Cache symbols in this directory" textbox. Click the "Empty Symbols Cache" button. Finally make sure the "Only specified modules" radio button is ticked.
4) in the Build/Configuration Manager menu for all projects make sure the configuration is in Debug mode.
PASO 4:
1) Reiniciar el App Pool en el IIS
2) Eliminar el archivo .suo
3) SI SE ESTA HACIENDO DEBUG DE UNA LIBRERIA, NO TENER EL FUENTE ABIERTO!! dejar que lo abra el debugger cuando llegue al breakpoint
PASO 5:
1) Abrir el archive de registro (RegEdit)
2) Buscar la llave HKEY_LOCALMACHINE -> SOFTWARE -> Microsoft -> Internet Explorer -> Main
3) Agregar la clave "Dword" llamada "TabProcGrowth" y asígnale el valor "0"
PASO 6:
Primero ejecutar la aplicacion.
Luego ir a Debug / Windows / Modules
elegir el assembly que corresponda al sitio (ej, RetWeb.dll)
Click derecho, y seleccionar "Symbol Load Information"
Start debugging, as soon as you've arrived at a breakpoint or used Debug > Break All, use Debug > Windows > Modules. You'll see a list of all the assemblies that are loaded into the process. Locate the one you want to get debug info for. Right-click it and select Symbol Load Information. You'll get a dialog that lists all the directories where it looked for the .pdb file for the assembly. Verify that list against the actual .pdb location. Make sure it doesn't find an old one.
In normal projects, the assembly and its .pdb file should always have been copied by the IDE into the same folder as your .exe. The bin\Debug folder of your project. Make sure you remove one from the GAC if you've been playing with it
1) Eliminar el archivo .suo
2) hacer clean del proyecto y luego arrancarlo con F10
PASO 2:
Tools / Options / Debugging / Symbols
En "Cache symbols in this directory" agregar el path del archivo .pdb de la solucion.
Ej:
C:\<ruta>\bin\Debug
PASO 3:
1) make sure all projects are using the same Framework (this is crucial!)
2) in Tools/Options>Debugging>General make sure "Enable Just My Code (Managed Only) is NOT ticked
3) in Tools/Options>Debugging>Symbols clear any cached symbols, untick and delete all folder locations under the "Symbols file (.pdb) locations" listbox except the default "Microsoft Symbol Servers" but still untick it too. Also delete any static paths in the "Cache symbols in this directory" textbox. Click the "Empty Symbols Cache" button. Finally make sure the "Only specified modules" radio button is ticked.
4) in the Build/Configuration Manager menu for all projects make sure the configuration is in Debug mode.
PASO 4:
1) Reiniciar el App Pool en el IIS
2) Eliminar el archivo .suo
3) SI SE ESTA HACIENDO DEBUG DE UNA LIBRERIA, NO TENER EL FUENTE ABIERTO!! dejar que lo abra el debugger cuando llegue al breakpoint
PASO 5:
1) Abrir el archive de registro (RegEdit)
2) Buscar la llave HKEY_LOCALMACHINE -> SOFTWARE -> Microsoft -> Internet Explorer -> Main
3) Agregar la clave "Dword" llamada "TabProcGrowth" y asígnale el valor "0"
PASO 6:
Primero ejecutar la aplicacion.
Luego ir a Debug / Windows / Modules
elegir el assembly que corresponda al sitio (ej, RetWeb.dll)
Click derecho, y seleccionar "Symbol Load Information"
Start debugging, as soon as you've arrived at a breakpoint or used Debug > Break All, use Debug > Windows > Modules. You'll see a list of all the assemblies that are loaded into the process. Locate the one you want to get debug info for. Right-click it and select Symbol Load Information. You'll get a dialog that lists all the directories where it looked for the .pdb file for the assembly. Verify that list against the actual .pdb location. Make sure it doesn't find an old one.
In normal projects, the assembly and its .pdb file should always have been copied by the IDE into the same folder as your .exe. The bin\Debug folder of your project. Make sure you remove one from the GAC if you've been playing with it
WaveEngine: mover un sprite
Recordar que los recursos (wpk) se generan con la utilidad Assets Exporter.
Luego, en visual studio, hay que marcar en las propiedades "Copy if newer"
#region Using Statements
using System;
using WaveEngine.Common;
using WaveEngine.Common.Graphics;
using WaveEngine.Common.Math;
using WaveEngine.Components.Cameras;
using WaveEngine.Components.Graphics2D;
using WaveEngine.Components.Graphics3D;
using WaveEngine.Framework;
using WaveEngine.Framework.Graphics;
using WaveEngine.Framework.Resources;
using WaveEngine.Framework.Services;
#endregion
namespace Prueba1_MovimProject
{
public class MyScene : Scene
{
protected override void CreateScene()
{
var camera2D = new FixedCamera2D("Camera2D") { BackgroundColor = Color.Black };
EntityManager.Add(camera2D);
Entity player = new Entity()
.AddComponent(new Transform2D())
.AddComponent(new Sprite("Content/ship.wpk"))
.AddComponent(new SpriteRenderer(DefaultLayers.Opaque))
.AddComponent(new PlayerBehavior());
EntityManager.Add(player);
}
protected override void Start()
{
base.Start();
// This method is called after the CreateScene and Initialize methods and before the first Update.
}
}
}
PlayerBehavior.cs
using System;
using WaveEngine.Common.Input;
using WaveEngine.Framework;
using WaveEngine.Framework.Graphics;
using WaveEngine.Framework.Services;
namespace Prueba1_MovimProject
{
class PlayerBehavior : Behavior
{
[RequiredComponent]
private Transform2D playerData;
protected override void Update(TimeSpan gameTime)
{
if ((WaveServices.Input.KeyboardState.Up == ButtonState.Pressed))
{
playerData.Y -= 5;
}
if ((WaveServices.Input.KeyboardState.Down == ButtonState.Pressed))
{
playerData.Y += 5;
}
if ((WaveServices.Input.KeyboardState.Left== ButtonState.Pressed))
{
playerData.X -= 5;
}
if ((WaveServices.Input.KeyboardState.Right == ButtonState.Pressed))
{
playerData.X += 5;
}
}
}
}
Suscribirse a:
Comentarios (Atom)