src/Misc/EFTools/EntityDesignModel/Commands/CreateMatchingFunctionImportCommand.cs
/// <summary>
///     Construct a return type to be used for the FunctionImport
/// </summary>
Construct a return type to be used for the FunctionImport
Construct a return type to be used for the FunctionImport
private static object ConstructReturnType(
            IRawDataSchemaProcedure schemaProcedure, ConceptualEntityModel cModel,
            StorageEntityModel sModel, string functionImportResultBaseName)
        {
            if (null == schemaProcedure)
            {
                Debug.Fail("null SchemaProcedure not allowed");
                return null;
            }
            else
            {
                var colCount = schemaProcedure.RawColumns.Count;
                if (0 == colCount)
                {
                    return Resources.NoneDisplayValueUsedForUX;
                }
                else if (1 == colCount)
                {
                    var col = schemaProcedure.RawColumns[0];
                    var primType = ModelHelper.GetPrimitiveType(sModel, col.NativeDataType, col.ProviderDataType);
                    if (null == primType)
                    {
                        Debug.Fail(
                            "Could not find primitive type for column with NativeDataType = " + col.NativeDataType + ", ProviderDataType = "
                            + col.ProviderDataType);
                        return null;
                    }
                    else
                    {
                        return primType.GetEdmPrimitiveType();
                    }
                }
                else
                {
                    var proposedName = String.Format(CultureInfo.CurrentCulture, "{0}_Result", functionImportResultBaseName);
                    var complexTypeName = ModelHelper.GetUniqueName(typeof(ComplexType), cModel, proposedName);
                    return complexTypeName;
                }
            }
        }
private static object ConstructReturnType ( IRawDataSchemaProcedure schemaProcedure , ConceptualEntityModel cModel , StorageEntityModel sModel , string functionImportResultBaseName ) { if ( null == schemaProcedure ) { Debug . Fail ( " " ) ; return null ; } else { var colCount = schemaProcedure . RawColumns . Count ; if ( 0 == colCount ) { return Resources . NoneDisplayValueUsedForUX ; } else if ( 1 == colCount ) { var col = schemaProcedure . RawColumns [ 0 ] ; var primType = ModelHelper . GetPrimitiveType ( sModel , col . NativeDataType , col . ProviderDataType ) ; if ( null == primType ) { Debug . Fail ( " " + col . NativeDataType + " " + col . ProviderDataType ) ; return null ; } else { return primType . GetEdmPrimitiveType ( ) ; } } else { var proposedName = String . Format ( CultureInfo . CurrentCulture , " " , functionImportResultBaseName ) ; var complexTypeName = ModelHelper . GetUniqueName ( typeof ( ComplexType ) , cModel , proposedName ) ; return complexTypeName ; } } }
Construct a return type to be used for the FunctionImport
Construct a return type to be used for the FunctionImport
// zero columns is equivalent to no return type // if 1 columns return a collection of scalars // if more than 1 column return a new ComplexType name (this will cause a new ComplexType with that name to be created)
schemaProcedure
IRawDataSchemaProcedure
cModel
ConceptualEntityModel
sModel
StorageEntityModel
functionImportResultBaseName
string