ODAC Released with Entity Framework and LINQ Support

Oracle Data Access Components Released with Entity Framework and LINQ Support

The production version of ODAC 11.2 Release 4 (11.2.0.3) has arrived for Entity Framework and LINQ developers! It includes 32-bit and x64 versions with the option of using an automated installer or xcopy deployment.

The release incorporates Oracle Database client 11.2.0.3, which can access Oracle Database 9.2 and higher. Oracle supports Entity Framework and LINQ with Microsoft Visual Studio 2010 and .NET Framework 4, including Entity Framework 4.1 and 4.2.

ODAC New Features List

Microsoft MVP Award for 2012

So I received an email, New Years day, informing me that I have been awarded my second MVP award.  I am glad Microsoft decided to keep the program going as they transition Commerce Server to Ascentium.

It is with great pride we announce that Bradley Foley has been awarded as a Microsoft® Most Valuable
Professional (MVP) for 1/1/2012 – 1/1/2013. The Microsoft MVP Award is an annual award that recognizes
exceptional technology community leaders worldwide who actively share their high quality, real world expertise
with users and Microsoft. All of us at Microsoft recognize and appreciate Bradley’s extraordinary contributions and
want to take this opportunity to share our appreciation with you.

I do with to keep working within the community, either with Commerce Server, or perhaps its time I learn a new trade. Who knows only time will tell.

Microsoft SQL Server 2012 RC0 is Now Available for Download!

http://www.microsoft.com/download/en/details.aspx?id=28145

System requirements

Supported Operating Systems: Windows 7, Windows Server 2008 R2, Windows Server 2008 Service Pack 2, Windows Vista Service Pack 2

  • 32-bit systems
    • Computer with Intel or compatible 1GHz or faster processor (2 GHz or faster is recommended.)
  • 64-bit systems
    • 1.4 GHz or faster processor
  • Minimum of 1 GB of RAM (2 GB or more is recommended.)
  • 2.2 GB of available hard disk space

The Future Of Commerce Server

A quick note about the Ascentium/Microsoft buzz about Commerce Server, here’s an official press release from Ascentium. And here it is again on their site.

Getting User Information For all the users in an Active Directory Group.

A recent requirement came up for a quick bit of code to retrieve the names and e-mail addresses from an ActiveDirectroy group. I did this in code instead of power shell in order to be able to use these methods in further logic.

So here we go….

First we’re going to create a simple structure to represent the user information we need:

        public struct UserInfo
       
{
            public string DisplayName;
            public string Mail;
            public string Login;
        }

Next were going to create a simple entry point in which we will use to test our methods:

static void Main(string[] args)
{
    ArrayList ar = GetADGroupUsers("GroupName");

    List<UserInfo> users = new List<UserInfo>();
    foreach (string user in ar)
    {
        users.Add(GetADUserInfo(user));

    }
}

 

Now we will need to implement the two methods seen above. First the method to get all the users in a group:

 

static public ArrayList GetADGroupUsers(string groupName)
{
    SearchResult result;
    DirectorySearcher search = new DirectorySearcher();
    search.Filter = String.Format("(cn={0})", groupName);
    search.PropertiesToLoad.Add("member");
    search.PropertiesToLoad.Add("mail");
    search.PropertiesToLoad.Add("samaccountname");
    result = search.FindOne();

    ArrayList userNames = new ArrayList();
    if (result != null)
    {
        for (int counter = 0; counter <
                 result.Properties["member"].Count; counter++)
        {

            userNames.Add((string)result.Properties["member"][counter]);
        }
    }
    return userNames;
}

Now that we have the ArrayList of users, we will need to get the information about the users:

static public UserInfo GetADUserInfo(string userName)
{
    SearchResult result;

    DirectoryEntry de = new DirectoryEntry("LDAP://mydomaincontroller/"+userName);

    UserInfo ui = new UserInfo();
    ui.DisplayName = de.Properties["displayName"].Value.ToString();
    ui.Mail = de.Properties["mail"].Value.ToString();
    ui.Login = de.Properties["sAMAccountName"].Value.ToString();
    return ui;

}

And that’s it, now we have a nice list of users with their email addresses.

5 Tips to a Successful Programmer Interview

  1. If you don’t know it, don’t put it on your resume.
    This is perhaps the most simple task. If you don’t embellish the technical portion of you resume you’re likely to find yourself interviewing for a position that matches your technical skills. This is critical because if you list it on your resume, and it’s a skill that they are looking for, you’re probably going to have to answer some questions about it.
  2. Confidence
    This is just too simple. Don’t push it so far as arrogance, but definitely show some confidence in yourself and in your past work.
  3. Don’t be afraid to say you don’t know.
    Nothing makes me want to end an interview faster than someone blowing smoke. If you don’t know, say so, we can move on to things you do. Also be prepared to answer, “Well since you don’t know, how would you go about learning to do that.”
  4. Be prepared to write some code.
    Although the recruiters often prepare the candidates of the fact that they are going to have to write some code. The technical interviews are very fluid and generally not written in stone. They can be adjusted to allow you to demonstrate your skill, but at the minimum you should be able to write some SQL, some data access and some basic programming such as methods, constructors, etc.  (Ask questions if you don’t understand what they are asking for…)
  5. Don’t waste their or your time.
    If you don’t think that your skills are a technical fit to the requirement, don’t bother interviewing. All your doing is wasting their time and yours.

How To Get The Commerce Server Extensibility Kit Deployment Friendly

When you first start out developing for Commerce Server 2009 R2, you notice there are quite a large amount of code that they provide you to get started with.

Where To Start:
First you need to find the CommerceSharePointExtensibilityKit.zip file located at C:\Program Files (x86)\Microsoft Commerce Server 9.0\Extensibility Kits
In this file you’ll see two Visual Studio solution files. I’m a fan of VS2010, so we’ll work with that, although it isn’t what these solutions were meant for.

Open the SharePointCommerce solution. Allow Visual Studio to do it’s conversion. You’ll now need to add the two other projects Common and SharePointCommon. They are located in the named directories from the base solution directory, you shouldn’t have any issues finding them.

Create your own SNK file:
Create a small console application with a SNK of your own choosing. Add signing to the project, then retrieve the PublicKeyToken for later use.

Replace the SNK file:
Copy your SNK file over the built in file MSSharedLibSN1024.snk, don’t delete rename, this will just create more work for you later.

Perform the following Search and Replace Operations within all files in the solution:

Search For:
Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

Replace With:
Version=1.0.0.0, Culture=neutral, PublicKeyToken=<YourKeyHere>

Search For:
Culture=Neutral, Version=1.0.0.0, PublicKeyToken=31bf3856ad364e35

Replace With:
Culture=Neutral, Version=1.0.0.0, PublicKeyToken=<YourKeyHere>

Manually Edit this file:
CommerceSharePointExtensibilityKit\SharePointCommon\FeatureActivation\CommerceFeatureActivationJobDefinition.cs Line: 1836
"Microsoft.CommerceServer.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=<YourKeyHere>

Replace with:
"Microsoft.CommerceServer.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

Now you will be able to build the entire solution, create the three WSP’s used by the custom installer, and use their handy tool to provision the site.

Commerce Server 2009 R2 RTM

So I received my regularly scheduled MSDN Flash newsletter, Volume 15, Number 19. I look in the new software available and it’s showing Commerce Server 2009 R2. I signed in to MSDN and there it was located under new downloads.

I haven’t heard any announcement other than that.

I will see what I can find out and post more… But the Standard and Enterprise editions are both there for download.

Security Token with the Commerce Claim Operation

So I just recently spun up a new virtual machine to do some Commerce Server 2009 R2 work. Did all my standard installation work, everything seemed good.

Then when I went to view the site, I get the following error:

An exception occurred when trying to issue security token: User DOMAIN\USERNAME is not authorized for the operation CommerceQueryOperation_CommerceClaim . Please open  CommerceEntityAuthorizationStore.xml in Authorization Manager and add the user to CommerceClaim\Role Assignments\CommerceQueryOperation.

The site was returning a 500 error, and this was all that was given in the event log. Since I needed a quick fix, this is only a development machine you know.

I turned to the channel configuration file, there is a new element called CommerceAuthorization, it was set to required.

Simply make the change here to Disabled, and the error will disappear…

Here is where to find the CommerceAuthorization element in the ChannelConfiguration.Config file.

image

Trouble Shooting Commerce Server 2009 Profile Extensions

This is the Exception that we will be looking at today:

The requested operation could not be performed because the CommerceEntity ‘CustomEntity’ does not map to a Commerce Server profile definition.

[FaultException`1: The requested operation could not be performed because the CommerceEntity 'TaxForm' does not map to a Commerce Server profile definition.]
Microsoft.Commerce.Providers.Utility.ProfileMetadata..ctor(CommerceEntityDefinition definition) +465
Microsoft.Commerce.Providers.Utility.ProfileMetadata.CreateProfileMetadata(MetadataCacheKey key, String modelName) +172
Microsoft.Commerce.Providers.Utility.<>c__DisplayClass5.<Get>b__4(MetadataCacheKey key) +54
Microsoft.Commerce.Application.Common.CachedFactory`2.GetOrCreate(TKey key, CreateInstance`2 factory) +435
Microsoft.Commerce.Providers.Utility.ProfileMetadata.Get(String modelName) +288
Microsoft.Commerce.Providers.Components.ProfileOperationSequenceComponent.get_Metadata() +89
Microsoft.Commerce.Providers.Components.ProfileOperationSequenceComponent.get_PrimaryKeyName() +40
Microsoft.Commerce.Providers.Components.RelatedProfileProcessorBase.ProcessQuery(CommerceQueryRelatedItem queryRelatedItem) +335
Microsoft.Commerce.Providers.Components.RelatedProfileOperationSequenceComponent.ExecuteQuery(CommerceQueryOperation queryOperation, OperationCacheDictionary operationCache, CommerceQueryOperationResponse response) +786
Microsoft.Commerce.Providers.Components.OperationSequenceComponent.Execute(CommerceOperation operation, OperationCacheDictionary operationCache, CommerceOperationResponse response) +348
Microsoft.Commerce.Providers.Components.ProfileOperationSequenceComponent.Execute(CommerceOperation operation, OperationCacheDictionary operationCache, CommerceOperationResponse response) +116
Microsoft.Commerce.Broker.OperationSequence.ExecuteComponentTree(List`1 executionTreeList, CommerceOperation operation, OperationCacheDictionary operationCache, CommerceOperationResponse response) +1040
Microsoft.Commerce.Broker.OperationSequence.Execute(CommerceOperation operation) +276
Microsoft.Commerce.Broker.MessageHandler.ProcessMessage(String messageHandlerName, CommerceOperation operation) +241
Microsoft.Commerce.Broker.OperationService.InternalProcessRequest(CommerceRequest request) +494
Microsoft.Commerce.Broker.OperationService.ProcessRequest(CommerceRequest request) +471
Microsoft.Commerce.Common.OperationServiceAgent.ProcessRequest(CommerceRequestContext requestContext, CommerceRequest request) +151

So I checked all of the standard things:

  1. Verified that ‘CustomEntity’ was setup correctly in Commerce Manager
  2. Ran a simple 2007 API based script to verify the relationship was setup correctly and that the ‘CustomEntity’ profile object was being returned correctly
  3. Checked the MetaDefinitions.xml and the ChannelConfiguration.config files to verify that they were indeed correct.
  4. Then I started scratching my head, I went over and over everything, and couldn’t figure out what was causing the problem.

Then I started using Reflector, in Visual Studio integrated mode, I choose the following assemblies to debug.

  • Microsoft.Commerce.Broker
  • Microsoft.Commerce.Common
  • Microsoft.Commerce.Contracts
  • Microsoft.Commerce.Providers

Then we start the debugging process and the exception occurs, but with out any indication as to why. Then I start stepping through the code and I notice a line in the Provider assembly.

 if (((target != null) && ProfileAssembly.Equals(target.get_CommerceServerAssembly(),
StringComparison.OrdinalIgnoreCase)) && ProfileTypeName.Equals(target.get_CommerceServerClass(),
StringComparison.OrdinalIgnoreCase))
          {
            return target;
          }

What this code is doing is essentially, checking the data we provided in our MetaDefinitions.xml file to make sure that it matches the assembly information.

  <!-- Custom Entity Start-->
            <CommerceEntity name="CustomEntity">
                <DisplayName value="Custom Entity" />
                <EntityMappings >
                    <EntityMapping
                                  csType="Microsoft.CommerceServer.Runtime.Profiles.Profile"
                                  csAssembly="Microsoft.CommerceServer.Runtime, Version=6.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                                  csDefinitionName="CustomEntity"
                                  csArea="Profiles">
                        <PropertyMappings>
                            <PropertyMapping property="Id" csProperty="GeneralInfo.u_Custom_Entity_id" />
                            <PropertyMapping property="FormName" csProperty="GeneralInfo.b_Custom_Entity_image" />
                            <PropertyMapping property="DateCreated" csProperty="GeneralInfo.dt_date_created" />
                            <PropertyMapping property="FormImage" csProperty="GeneralInfo.u_Custom_Entity_name"/>
                        </PropertyMappings>
                    </EntityMapping>
                </EntityMappings>
            </CommerceEntity>
            <!-- Custom Entity End—>

Do you see the problem? Well at first neither did I, and for that matter at second or third…. Look closely at this line

csAssembly=”Microsoft.CommerceServer.Runtime, Version=6.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″

Is should actually read:

csAssembly=”Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″

Once that simple typo was corrected, the whole process seemed to come to life.