I'm using BIML to create my package.
There is a sequence container where I want to set the system variable Propagate to False.
I cannot find the method in BIML to set the system variable for Propagate.
Propagate is a System scoped variable that only exists within Event Handlers.
The following Biml creates an SSIS Package with an OnError event handler that has an empty Sequence Container
The Event itself redefines the System::Propagate variable to have a value of false instead of the default value of true
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Packages>
<Package Name="so_38121956">
<Events>
<Event EventType="OnError" Name="OnError">
<Variables>
<Variable DataType="Boolean" Name="Propagate" Namespace="System">false</Variable>
</Variables>
<Tasks>
<Container Name="SEQC Propagate no more">
</Container>
</Tasks>
</Event>
</Events>
</Package>
</Packages>
</Biml>
Try using BIML Online.
http://bimlonline.com/
Here you can upload an existing SSIS package with propagate set and the browser based application will reverse engineer it for you to give you the BIML.
Its handy if you know how to do something in SSIS, but not sure of the BIML equivalent.
Officially its still in Beta, but works well.
Related
When I open the services.xml in PhpStorm with Symfony Plugin enabled, it's able to resolve all the services, I can Ctrl+Click and go the Service Definition , except doctrine.orm.entity_manager.
It says unable to resolve symbol 'doctrine.orm.entity_manager'
Here is the services.xml file
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="example_manager" class="Vendor\XysBundle\Manager\ExampleManager">
<argument type="service" id="doctrine.orm.entity_manager" />
</service>
</services>
</container>
PhpStorm Details:
PhpStorm 2016.3.1
Build #PS-163.9735.1, built on December 6, 2016
JRE: 1.8.0_112-release-408-b2 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
appDevDebugProjectContainer.xml file exists in the app/cache directory .
How can I get get this working ?
I have the same issue. If you open up the vendor\doctrine\doctrine-bundle\Resources\config\orm.xml file where doctrine services are defined, you can see, there is no service with the id "doctrine.orm.entity_manager" but only "doctrine.orm.entity_manager.abstract"
The definition looks like:
<service id="doctrine.orm.entity_manager.abstract" class="%doctrine.orm.entity_manager.class%" abstract="true" />
As you can see the abstract attribute is set to true. This means this service can serve as a parent of other services, and when you define child services with this abstract parent you don't have to define the method calls or the parameters injected into the constructor for example, instead these definitions will be inherited from the parent.
If you investigate a bit deeper you will find that %doctrine.orm.entity_manager.class% is defined in the same file as a parameter that actually references to the Doctrine Entity Manager:
<parameter key="doctrine.orm.entity_manager.class">Doctrine\ORM\EntityManager</parameter>
So I guess we should use doctrine.orm.entity_manager.abstract, however doctrine.orm.entity_manager is recognised as well, although I don't know how.
For further explanation of abstract service definitions have a look at this Symfony doc page: https://symfony.com/doc/current/service_container/parent_services.html
Having setup my WebAPI OData endpoint by doing this ...
http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/odata-v4/create-an-odata-v4-endpoint
I then tried adding a function as per the "Example:Adding a function" section at the bottom of this ...
http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/odata-v4/odata-actions-and-functions
I hit a bit of a problem as the method call "builder.EntityType()" does not exist but everything else is up and running fine.
Is there some special dependency I don't know about?
I'm using version 5.6.0 (latest stable) of the OData v4 package from nuget and compiling against .Net 4.6.
EDIT:
I tried updating the reference to the 5.7.0-rc build of the OData package, but that did solve it either, here's the bit we care about from my packages.config ...
<packages>
<package id="EntityFramework" version="6.1.3" targetFramework="net46" />
<package id="Microsoft.AspNet.OData" version="5.7.0-rc" targetFramework="net46" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net46" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.Cors" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net46" />
<package id="Microsoft.Data.Edm" version="5.6.4" targetFramework="net46" />
<package id="Microsoft.Data.OData" version="5.6.4" targetFramework="net46" />
<package id="Microsoft.OData.Core" version="6.13.0" targetFramework="net46" />
<package id="Microsoft.OData.Edm" version="6.13.0" targetFramework="net46" />
<package id="Microsoft.Spatial" version="6.13.0" targetFramework="net46" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net46" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net46" />
</packages>
I'm using a few other things like ninject to do some DI stuff but I have not included those here to keep the question short.
Ok it turns out for some reason there was version 5.5.1.0 of the package in my bin folder which it was choosing to pick up despite an assembly binding to tell it to use the later 5.7.0.0 version.
Also to really mess with my head Microsoft have moved a bunch of stuff around and some using statements had to be changed in my class (possibly why my code was using an older version) ...
Old usings:
using Microsoft.Data.Edm;
using System.Web.Http.OData.Builder;
New usings:
using Microsoft.OData.Edm;
using System.Web.OData.Builder;
using System.Web.OData.Extensions;
It's probably worth noting that as the walkthrough makes no mention of usings or version numbers, it just says "we used OData v4" ... helpful as ever!
I had to dig through the source on codeplex to find the answer but essentially that walkthrough is based on 5.7.0.0 or later of the package.
I've encountered a problem when using struts2.
I want to use both struts2 json plugin and ssl plugin.
But in the struts.xml they need to extend default packages.
<package name="myPackage1" extends="json-default">
<package name="myPackage1" extends="ssl-default">
How can I use both of the plugins?
Thanks!!
When declaring a package you must declare both extensions together, instead of declaring a package two times.
Try using
<package name="myPackage1" extends="json-default,ssl-default">
I have the following three components defined in the Caste-Windsor XML configuration for my application:
<component id="StringFactory"
service="IStringFactory, MyApp"
type="DefaultStringFactory, MyApp"
lifestyle="singleton"
/>
<component id="TheString"
type="System.String"
factoryId="StringFactory"
factoryCreate="CreateString"
>
<parameters>
<name>SomeString</name>
</parameters>
</component>
<component id="TheTarget"
service="ITarget, MyApp"
type="TheTarget, MyApp"
lifestyle="transient"
>
<parameters>
<aString>${TheString}</aString>
</parameters>
</component>
And the following facility defined:
<facility id="factory.support"
type="Castle.Facilities.FactorySupport.FactorySupportFacility, Castle.MicroKernel"
/>
When I run the application and set a breakpoint in the constructor of the TheObject class, the value passed in as the aString parameter is "${TheString}" when I expect it to resolve to the value of the component with that name.
Also, I have a breakpoint in the StringFactory constructor and CreateString method, neither of which are hit. I know the configuration is being used as other components are resolving correctly.
What am I missing or doing wrong here?
UPDATE
In light of the huge tangient this topic has taken, I've refactored the code above to remove anything to do with connection strings. The original intent of this post was about injecting a property with the value returned from a method on another object. Somehow that point was lost in a discussion about why I'm using XML versus code-based configuration and if this is a good way to inject a connection string.
The above approach is far from an original idea and it was pulled from several other discussions on this topic and our requirements are what they are. I'd like help understanding why the configuration as it is in place (whether the right approach or not) isn't working as expected.
I did verify that the first two components are being instantiated correctly. When I call Container.Resolve("TheString"), I get the correct value back. For whatever reason, The parameter syntax is not working correctly.
Any ideas?
While not a definitive solution to what I need to do in my application, I believe I've figured out what is wrong with the code. Or at least I've found a way to make it work which hints at the original problem.
I replaced the String type for TheString with a custom class. That's it. Once I did that, everything worked fine.
My guess is that it has something to do with the fact that I was trying to use a ValueType (primitive) as a component. I guess Castle doesn't support it.
So, knowing that's the case, I can now move on to figuring out if this approach is really going to work or if we need to change direction.
UPDATE
For the sake of completeness, I thought I'd go ahead and explain what I did to solve my problem AND satisfy my requirements.
As before, I have access to my configuration settings through an IConfigurationService defined as:
<component id="ConfigurationService"
service="MyApp.IConfigurationService, MyApp"
type="MyApp.RuntimeConfigurationService, MyApp"
lifestyle="singleton"
/>
This is automatically injected into my (new) IConnectionFactory which is responsible for generating IDbConnection objects based on the connection strings defined in the application's configuration file. The factory is declared as:
<component id="ConnectionFactory"
service="MyApp.Factories.IConnectionFactory, MyApp"
type="MyApp.Factories.DefaultConnectionFactory, MyApp"
lifestyle="singleton"
/>
In order to resolve what connection is used by my repository, I declare each connection as a component using the ConnectionFactory to create each instance:
<component id="MyDbConnection"
type="System.Data.IDbConnection,
System.Data, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
factoryId="ConnectionFactory"
factoryCreate="CreateConnection"
lifestyle="transient"
>
<parameters>
<connectionStringName>MyDB</connectionStringName>
</parameters>
</component>
Notice the fully described reference to System.Data. I found this is necessary whenever referencing assemblies in the GAC.
Finally, my repository is defined as:
<component id="MyRepository"
service="MyApp.Repositories.IMyRepository, MyApp"
type="MyApp.Sql.SqlMyRepository, MyApp.Sql"
lifestyle="transient"
>
<parameters>
<connection>${MyDbConnection}</connection>
</parameters>
</component>
Now everything resolves correctly and I don't have ANY hard-coded strings compiled into my code. No connection string names, app setting keys or whatever. The app is completely reconfigurable from the XML files which is a requirement I must satisfy. Plus, other devs that will be working with the solution can manage the actual connection strings in the way they are used to. Win-win.
Hope this helps anyone else that runs into a similar scenario.
You don't really need XML registrations here, since you probably don't need to swap components or change the method used without recompiling. Writing a configurable app does not imply having to use XML registrations.
The problem with this particular XML registration you posted is that the connection string is a parameter, but it's treated like a service.
Doing this with code registrations is much easier, e.g.:
var container = new WindsorContainer();
container.Register(Component.For<IConfigurationService>().ImplementedBy<RuntimeConfigurationService>());
container.Register(Component.For<ITheRepository>().ImplementedBy<TheRepository>()
.LifeStyle.Transient
.DynamicParameters((k, d) => {
var cfg = k.Resolve<IConfigurationService>();
d["connectionString"] = cfg.GetConnectionString();
k.ReleaseComponent(cfg);
}));
Or if you don't want to depend on IConfigurationService, you could do something like:
container.Register(Component.For<ITheRepository>().ImplementedBy<TheRepository>()
.LifeStyle.Transient
.DependsOn(Property.ForKey("connectionString")
.Is(ConfigurationManager.ConnectionStrings[ConfigurationManager.AppSettings["connName"]].ConnectionString))
Is there a way to read a System.Config connection string in an MSBuild task?
Basically I have my connection string setup in a config file
<add name="MyApp.MyConnectionString" connectionString="..." />
And I would like to reference it in an MSBuild task like so ...
<Target Name="Migrate" DependsOnTargets="Build">
...
<Migrate Connectionstring="$(MyApp.MyConnectionString)" ... />
</Target>
There's an XMLRead task in the MSBuild Community Tasks Project, that uses xpath to pull out a value.
<XmlRead
XPath="/add/#connectionString"
XmlFileName="app.config">
<Output TaskParameter="Value" PropertyName="MyConnectionString" />
</XmlRead>
<Message Text="MyConnectionString: $(MyConnectionString)"/>
(note: totally untested)