I am using Spring.Net for IOC and AOP. It seems Spring.Net does not support multiple AutoProxyCreators. I have following classes:
[Facade]
public abstract class AbstractFacade{
}
[TransactionSupportFacade]
public abstract class AbstractTransactionSupportFacade{
}
Some classes are inherited from above classes, I have following xml configuration:
<object type="Spring.Aop.Framework.AutoProxy.AttributeAutoProxyCreator , Spring.Aop">
<property name="AttributeTypes">
<list>
<value>Common.Attributes.TransactionSupportFacadeAttribute, Common</value>
</list>
</property>
<property name="InterceptorNames">
<list>
<value>JUTransactionInterceptor</value>
</list>
</property>
<property name="CheckInherited">
<value>true</value>
</property>
</object>
<object type="Spring.Aop.Framework.AutoProxy.AttributeAutoProxyCreator , Spring.Aop">
<property name="AttributeTypes">
<list>
<value>Common.Attributes.FacadeAttribute, Common</value>
</list>
</property>
<property name="InterceptorNames">
<list>
<value>IdentifyServiceAspect</value>
<value>PushIdentityAspect</value>
<value>AuthenticationAdvice</value>
<value>ValidationAspect</value>
<value>ServiceCallResultWrapperAspect</value>
</list>
</property>
<property name="CheckInherited">
<value>true</value>
</property>
</object>
the problem raises here, only one of these AttributeAutoProxyCreators work at the same time, please help me to solve this problem.
Related
I'm having a hard time getting my ad to show.
Here is my ad element:
<Universal:AdMediatorControl x:Name="AdMediator_2CB784" Height="80" Id="AdMediator-Id-30C8B005-60BC-4616-A7E5-06946A425C5D" Margin="0" Grid.Row="0" VerticalAlignment="Top" />
In visual studios I added the connected service and I configured the Ad Mediation during the first submission (It passed certification but I haven't published it.)
This is what autopopulated when I added the connected service:
<?xml version="1.0" encoding="utf-8"?>
<AdMediatorConfiguration xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<BaseConfiguration>
<AdAdapters>
<AdAdapterInfo>
<Metadata>
<Property>
<Key>WApplicationId</Key>
<Value>fc24e866-0e16-40be-8c10-6908c9b6a4b7</Value>
</Property>
<Property>
<Key>MApplicationId</Key>
<Value>fc24e866-0e16-40be-8c10-6908c9b6a4b7</Value>
</Property>
</Metadata>
<Name>MicrosoftAdvertising</Name>
<Weight>100</Weight>
</AdAdapterInfo>
</AdAdapters>
<AdAdapters>
<AdAdapterInfo>
<Metadata>
<Property>
<Key>WApplicationId</Key>
<Value>f005d95d-4adf-4b55-8020-3b56d74f3253</Value>
</Property>
<Property>
<Key>WAdUnitId</Key>
<Value>242247</Value>
</Property>
<Property>
<Key>WWidth</Key>
<Value>300</Value>
</Property>
<Property>
<Key>WHeight</Key>
<Value>250</Value>
</Property>
<Property>
<Key>MApplicationId</Key>
<Value>22c93881-85e4-487e-bd1a-b9175857e320</Value>
</Property>
<Property>
<Key>MAdUnitId</Key>
<Value>242249</Value>
</Property>
<Property>
<Key>MWidth</Key>
<Value>480</Value>
</Property>
<Property>
<Key>MHeight</Key>
<Value>80</Value>
</Property>
</Metadata>
<Name>MicrosoftAdvertising</Name>
<Rank>1</Rank>
<Weight>100</Weight>
</AdAdapterInfo>
</AdAdapters>
<AdControlConfigurations>
<AdControlConfiguration>
<AdAdapters>
<AdAdapterInfo>
<Metadata>
<Property>
<Key>WAdUnitId</Key>
<Value>10043121</Value>
</Property>
<Property>
<Key>MAdUnitId</Key>
<Value>10865270</Value>
</Property>
</Metadata>
<Name>MicrosoftAdvertising</Name>
</AdAdapterInfo>
</AdAdapters>
<Id>AdMediator-Id-30C8B005-60BC-4616-A7E5-06946A425C5D</Id>
<Name>AdMediator_2CB784</Name>
</AdControlConfiguration>
</AdControlConfigurations>
</BaseConfiguration>
<FileVersion>1.0.1</FileVersion>
<RefreshRate>30</RefreshRate>
<SchemaVersion>1.0.3</SchemaVersion>
<UpdatedDateTime>2015-09-06T15:06:23.7901527Z</UpdatedDateTime>
<UseRoundRobin>true</UseRoundRobin>
</AdMediatorConfiguration>
Per the developer dashboard, fc24e866-0e16-40be-8c10-6908c9b6a4b7 is my application ID. I'm not sure if there should be two or not, but I tried removing those nodes, changing the ID value to my application ID, but nothing happens.
In my app, there just a blank space where my ad unit is. Please help. Thanks.
Here is what worked for me, but I am still not certain it is the best control.
Here's the link I followed:
https://msdn.microsoft.com/en-us/library/windows/apps/xaml/mt219682.aspx
I have followed many tutorials here on LINQ to XML http://www.dotnetcurry.com/showarticle.aspx?ID=564
The terminology for the XML documents is confusing.
Could someone please help me to write the code snippet that would extract the "Name" value from this xml based on a condition for example.
I need colSDate and colAcqDate because Visible is True but not colSeqNo because it does not have the Visible property or it is set to False.
<XtraSerializer version="1.0" application="View">
<property name="#LayoutVersion" />
<property name="ActiveFilterEnabled">true</property>
<property name="Columns" iskey="true" value="286">
<property name="Item1" isnull="true" iskey="true">
<property name="Name">colSeqNo</property>
</property>
<property name="Item2" isnull="true" iskey="true">
<property name="Visible">true</property>
<property name="VisibleIndex">0</property>
<property name="Name">colSDate</property>
</property>
<property name="Item3" isnull="true" iskey="true">
<property name="Visible">true</property>
<property name="VisibleIndex">1</property>
<property name="Name">colAcqDate</property>
</property>
</property>
<property name="ActiveFilterString" />
<property name="GroupSummarySortInfoState" />
<property name="FindFilterText" />
<property name="FindPanelVisible">false</property>
</XtraSerializer>
I am trying to write some reasonably performing data access code but the absurd requirements are making it difficult. Any help is extremely appreciated. Thanks in advance.
Here is one way to do it, using LINQ to XML:
Dim result = From d In xml.Descendants("property")
Where d.Attribute("name").Value = "Visible" AndAlso
d.Value = "true"
From e As XElement In d.Parent.Elements
Where e.Attribute("name").Value = "Name"
Select e.Value
or using XPath (not sure if you want vb or c# code, not a huge dif):
Dim x As XmlNodeList = ' ... pardon the break here, want to get it all in window.
d.SelectNodes(".//property[#name='Visible'][.='true']/../property[#name='Name']")
I am having some problem configuring NHibernate to retrieve data in my MVC 4 application.
To keep things simple I have configured all code in the Index method.
Here is code for my Category controller :
and here is my configuration in web.config :
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory name="NHibernate.Test">
<property name="connection.driver_class">
NHibernate.Driver.SqlClientDriver
</property>
<property name="connection.connection_string">
Data Source=.;Initial Catalog=UsingNH;uid=myuid;Password=mypwd
</property>
<property name="adonet.batch_size">10</property>
<property name="show_sql">true</property>
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
<property name="use_outer_join">true</property>
<property name="command_timeout">60</property>
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<property name="proxyfactory.factory_class">
NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu
</property>
</session-factory>
</hibernate-configuration>
Mapping file for Category is
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="nhibernate-mapping-2.2" namespace="UsingNHibernate.Models" assembly="UsingNHibernate">
<class name="Category" table="Categories" lazy="false">
<id name="Id" columnId="Id" unsaved-value="0">
<generator class="native" />
</id>
<property name="Name">
<column name="Name" data-type="varchar(50)" not-null="true" />
</property>
</class>
</hibernate-mapping>
and the Category table schema is
CREATE TABLE [dbo].[Categories](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Name] [varchar](50) NOT NULL,
CONSTRAINT [PK_Category] PRIMARY KEY CLUSTERED
(
[Id] ASC
)
) ON [PRIMARY]
The problem is that the program compiles and runs well but does not return any category.
The code
var lst = (List<Category>)criterion.List<Category>();
returns 0 items (verified in debugger).
Is there any problem in my configuration or Mapping files?
Comment if additional info is required.
Thanks.
If no mappings are defined, nhibernate will simply fail silently and return an empty list if you query a list of entities.
I guess you do not copy over the mapping files to your bin directory. Mark the mapping files to be copied (via properties).
I changed the Build Action Property of the hbm mapping file to Embedded Resource,
then I can get the data.
(It's same way as the OP's comment, but I post it as an answer to be easier noticed.)
I have a tree structure mapped to the data base in a table like this:
UID numeric(18, 0)
NodeUID varchar(50)
Text nvarchar(50)
TreeLevel int
ParentUID varchar(50)
OrderInLevel int
IsLeaf bit
It is an old table and I cannot change it so bear with me...
The NodeUID is a GUID.
the ParentUID column is mapped to the NodeId of a different row.
A root node has a value of "0" in its ParentUID column.
I am trying to map the Tree with NHibernate like this:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="BasicFW.Core.Domain.NavigationTree.UsersNavigationTreeNode, BasicFW.Core" table="bDoxTreeNodes" lazy="false" schema="bDox.dbo">
<id name="NodeUId">
<column name="NodeUID"/>
<generator class="assigned"/>
</id>
<property name="Text">
<column name="Text"/>
</property>
<property name="TreeLevel">
<column name="TreeLevel"/>
</property>
<property name="IsLeaf">
<column name="IsLeaf"/>
</property>
<many-to-one name="Parent" class="BasicFW.Core.Domain.NavigationTree.UsersNavigationTreeNode, BasicFW.Core" column="ParentUID" not-found="ignore"/>
<bag name="Children" lazy="false" order-by="OrderInLevel ASC" cascade="all-delete-orphan" inverse="true">
<key column="ParentUID"/>
<one-to-many class="BasicFW.Core.Domain.NavigationTree.UsersNavigationTreeNode, BasicFW.Core" />
</bag>
</class>
</hibernate-mapping>
The thing is that when I try to update a node ( and a root node in specifies ) the Parent property is null and so NHibernate try`s to Update the ParentUID column to null, and so it failles since to column will not accept null.
thanks
Can you create a trigger for that table? If yes, you could perhaps create a trigger that fires before update/insert. Something like:
create trigger TreeNode_before before insert, update
on TreeNode
referencing NEW as _new
for each row
begin
if _new.ParentUID is null then
set _new.ParentUID = '0';
end if;
end;
Edit: An alternative would be using an interceptor. I have not used that myself but according to the following question it should work in your case, too.
Edit: fixed the link.
NHibernate write value = NULL when ID < 0
I have found the correct mapping that worked, here is the mapping for my tree.
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="BasicFW.Core.Domain.NavigationTree.UsersNavigationTreeNode, BasicFW.Core" table="TreeNodes" lazy="false" >
<id name="NodeID">
<column name="NodeUID"/>
<generator class="assigned"/>
</id>
<property name="Text">
<column name="Text"/>
</property>
<property name="TreeLevel">
<column name="TreeLevel"/>
</property>
<property name="ParentID" >
<column name="ParentUID" />
</property>
<property name="IsLeaf">
<column name="IsLeaf"/>
</property>
<many-to-one name="Parent" class="BasicFW.Core.Domain.NavigationTree.UsersNavigationTreeNode, BasicFW.Core" column="ParentUID" not-found="ignore" update="false" insert="false"/>
<bag name="Children" lazy="false" order-by="OrderInLevel ASC" inverse="true" cascade="all-delete-orphan">
<key column="ParentUID"/>
<one-to-many class="BasicFW.Core.Domain.NavigationTree.UsersNavigationTreeNode, BasicFW.Core"/>
</bag>
</class>
</hibernate-mapping>
I have disabled the update and insert in the Parent property.
Why don't I have any class mappings after calling Configuration.Configure()?
Here is my class mapping file Category.hbm.xml for BudgetModel.Category:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="BudgetModel" namespace="BudgetModel">
<class name="Category" table="Categories">
<id name="Id" type="Int32">
<generator class="native" />
</id>
<property name="Name" type="string" not-null="true" />
</class>
</hibernate-mapping>
EDIT
NH version is 2.1.1.GA
Category.hbm.xml is an embedded resource & I have rebuilt.
You need to tell NHibernate where your mapping files are. You normally do this either programmatically or in the configuration file.
config.AddAssembly(typeof(Category).Assembly);
or
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<!--Configuration Properties-->
<mapping assembly="BudgetModel" />
</session-factory>
</hibernate-configuration>
Also, your hibernate mapping file must be set with a build action of embedded resource.