Archive for April, 2008

h1

The trust relationship between this workstation and the primary domain failed

April 16, 2008

Once time I obtained this error message, when I executed my SCSF application.

Failed to load module from assembly XXX. Error was: Failed to load module from assembly XXX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.

 Error was:

The trust relationship between this workstation and the primary domain failed. The trust relationship between this workstation and the primary domain failed

Stack Trace:

Exception Class: Microsoft.Practices.CompositeUI.Services.ModuleLoadException
Failed to load module from assembly XXX. Error was:
Failed to load module from assembly XXX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. Error was:
The trust relationship between this workstation and the primary domain failed.
 
 

 

Solution

I restaryed IIS by iisreset command from commandline.

h1

UML crib 1

April 8, 2008

This is my UML crib, taht is devoted to relationships between entities. Be careful, I don’t recognize between analyze and design disciplines in this crib

I found nice links here:

Association

associations

NOTE:  Undefined line between entity (no arrow) is used in Architecture. But in the design dicipline it has no sense. In the design discipline it means bi-directional arrow <->. Or nothing. In the all cases. Use it in Analyse discipline, but not in the design discipline. 

Aggregation

 

Aggregation

Composition

 

Composition

NOTE: By my opinion. It has no sense in the analyse discipline. Use it in the design discipline.

Specialization

 

Specialization

Association versus Aggregation

 

AssociationVsAggregation

Aggregation versus Composition

AggregationVsComposition

h1

missing .svc and empty Web.config in http://localhost/FenixServices/ project .Nettiers

April 4, 2008

Jak k tomu doslo.
Projekt se servicama jsem mel uplne prazdny (prohledanim solution explorerem). V IIS manageru jsem videl to co v Solution Exploreru.

Chyba byla v tom ze:  

  • TFS mi nechtelo nahravat veci do workspacu.
  • Vytvoril jsem novy workspace a nahral do nej solutionu
  • Nejakym prapodivnym zpusobem jsem modifikoval Fenix.Wcf.Deploy, kde jsem nastavil absolutni cesty na novy workspace. 
  • Zacheckoval
  • Druhy den jsem prisel zpatky a po restartu jsem mohl nahrat data do puvodniho workspacu
  • Data obsahovala cesty na absolutni data stareho workspacu
  • Vygeneroval se Virtual directory na FenixServices na IIS
  • Byl uplne prazdny
  • Server vracel chybu Inernal error 500 -(*.svc tam nebyly)
  • Musel se opravit Fenix.Wcf.Deploy na relativni cesty
  • znovu stahnout solutiona
  • Pokud jsem zadal do prohlizece URL nove orchestrace, dostal jsem:http://localhost/FenixServices/Orchestrations/XXXXService.svc

    The type ‘Fenix.Services.Orchestrations.XXXXService’, provided as the Service attribute value in the ServiceHost directive could not be found.

  • Zkompiloval jsem a zkusil znovu, obdrzel jsem:Security settings for this service require Windows Authentication but it is not enabled for the IIS application that hosts this service.
  • IIS manager -> FenixServices virtual path -> properties -> directory security – > Edit -> check Integrated Windows auth..
  • HOTOVO :)
h1

Custom config sections

April 3, 2008

DO NOT FORGET IMPORT System.Configuration.dll

APP.CONFIG

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <sectionGroup name ="FutureActivityGroup">
      <section name="FutureActivities" type="ConfigSectionForAgent.FutureActivityConfigHandler, ConfigSectionForAgent"/>
    </sectionGroup>
  </configSections>
 
  <FutureActivityGroup>
    <FutureActivities>
      <FutureActivity id="001" service ="AFE" passengerImportance="HC"/>
      <FutureActivity id="002" service ="CSA" passengerImportance="HC"/>
    </FutureActivities>    
  </FutureActivityGroup>  
</configuration>

 

PROGRAM

 

namespace ConfigSectionForAgent
{
    class Program
    {
        static void Main(string[] args)
        {
            FutureActivityConfigHandler config = (FutureActivityConfigHandler) System.Configuration. ConfigurationManager.GetSection("FutureActivityGroup/FutureActivities"); 
        }
    }
}

 

CONFIG HANDLER

 

namespace ConfigSectionForAgent
{
    public class FutureActivityConfigHandler : ConfigurationSection 
    {
        public FutureActivityConfigHandler()
        {
        }
        
        [ConfigurationProperty("", IsDefaultCollection = true, IsKey = false, IsRequired = true)]
        public FutureActivityCollection FutureActivities
        {
            get
            {
                return base[""] as FutureActivityCollection;
            }
        }
       
    }
}

 

CONFIGURATION COLLECTION

 

namespace ConfigSectionForAgent
{
    public class FutureActivityCollection : ConfigurationElementCollection
    {
 
 
        public FutureActivityElement this[int index]
        {
            get { return BaseGet(index) as FutureActivityElement; }           
        }
 
        protected override string ElementName
        {
            get
            {
                return "FutureActivity";
            }
        }
 
        protected override bool IsElementName(string elementName)
        {
            return !String.IsNullOrEmpty(elementName) && elementName == ElementName;
        }
 
        public override ConfigurationElementCollectionType CollectionType
        {
            get
            {
                return ConfigurationElementCollectionType.BasicMap;
            }
        }
 
 
        #region overrided  methods
        ///<summary>
        ///When overridden in a derived class, creates a new <see cref="T:System.Configuration.ConfigurationElement"></see>.
        ///</summary>
        ///
        ///<returns>
        ///A new <see cref="T:System.Configuration.ConfigurationElement"></see>.
        ///</returns>
        ///
        protected override ConfigurationElement CreateNewElement()
        {
            return new FutureActivityElement();
        }
 
        ///<summary>
        ///Gets the element key for a specified configuration element when overridden in a derived class.
        ///</summary>
        ///
        ///<returns>
        ///An <see cref="T:System.Object"></see> that acts as the key for the specified <see cref="T:System.Configuration.ConfigurationElement"></see>.
        ///</returns>
        ///
        ///<param name="element">The <see cref="T:System.Configuration.ConfigurationElement"></see> to return the key for. </param>
        protected override object GetElementKey(ConfigurationElement element)
        {
            return ((FutureActivityElement)element).Id;
        }
 
        #endregion
    }
}

 

CONFIGURATION ELEMENT 

namespace ConfigSectionForAgent
{
    public class FutureActivityElement : ConfigurationElement
    {         
        [ConfigurationProperty("id", IsRequired=true, IsKey=true)]
        public string Id
        {
            get { return ((string)base["id"]); }
            set { base["id"] = value; }
        }
 
        [StringValidator(InvalidCharacters = " ~!@#$%^&*()[]{}/;'\"|\\", MaxLength = 3)]
        [ConfigurationProperty("service", IsRequired = true)]
        public string Service
        {
            get { return ((string)base["service"]); }
            set { base["service"] = value; }
        }
 
        //[StringValidator(InvalidCharacters = " ~!@#$%^&*()[]{}/;'\"|\\", MinLength = 1, MaxLength = 2)]
        [ConfigurationProperty("passengerImportance", IsRequired = true)]
        public string PassengerImportance
        {
            get { return ((string)base["passengerImportance"]); }
            set { base["passengerImportance"] = value; }
        }
    }
}

 

h1

Agenti v .NetTiers, pres WCF

April 3, 2008

Agenti jsou servicy, ktere periodicky spousteji nejaky kod. Napriklad prepocitavani priorit tasku, generovani tasku atd…
Dulezitym prvkem je to, ze kod, ktery agenti vykonavaji je lepsi drzet na strane orchestraci.
Proc?? 
Pokud budeme volat kod na strane agenta (client-side), musime resit serializace (napriklad serializaci CaseQuery, ktery posilame service).V agentovi volame servicy ktere jsou na strane serveru. Musime si uvedomit, ze neni mozne volat primo servicy z Aplikace, ktera bezi na localhostu. Tim myslim nevolat

IService service = new Services.Service()

Musime volat pekne pres WCF servicy, ktere jsou ne na localu, ale na strane aplikace:

IFutureActivityService futureActivityService = WcfClient.ProxyFactory.Orchestrations.FutureActivityProxyInstance();Potom ale nesmime zapomenout endpointy v App.configu.

Dale je vhodne zvazit, jestli uz operace nad DB nevolat primo v SQL procedurach. Opet si tim muzeme usetrit spousty prace. Udelat join pres vice jak dve tabulky je v .Nettiers preci jenom orisek. Pokud chceme volat spolecne s nasi metodou Workflow, pouziti trored procedur zase nemusi byt nejlepsi napad. Tim myslim, volat z SP workflow. furtn nam ale SP mohou velmi zjednodusit zivot. Dalsi vyhodou pro pouziti servis na strane aplikace je fakt, ze se to mnohonasobne lepe testuje. Jenom zavolate metodu servicy v unit testu. Nejakeho agenta neresite.  
 

  • Zkratka agent by se mel postarat pouze o spusteni metody v orchestraci a na nejakou dobu skoncit. Nic vic, nic min. Usetrime si tim mraky casu.
  • Vsechna logika musi byt na strane orchestraci, usetrime si ohromna kvanta prace!!
  • Vzdy zvazte pouziti Stored procedur, pokud agent dela hromadne operace nad DB.
      
h1

Event in UC – not completed

April 2, 2008

This code I’m using for adding handled methods to the controls in UserControls.

private object _flightCompanyLocker = new object();

/// <summary>
/// Used for adding handlers to lueFlightCompany
/// </summary>
public event EventHandler FlightCompanyEditValueChanged
{
  add
  {
    lock (_flightCompanyLocker)
         {lueFlightCompany.EditValueChanged += value; }
  }
  remove
  {
    lock (_flightCompanyLocker)
         {lueFlightCompany.EditValueChanged -=  value;}
  }
}