Unable to remove date/time stamps on generated files - codefluent

I am unable to remove the date/time stamps from the generated files.
The problem is, when I'm editing the .cfp file, I'll set the Production Flags to "Overwrite, RemoveDates". But soon as I save the file, the Production Flags automatically get re-written as "Default, RemoveDates". This happens at both the Producer and Project Level.
If I use the projects advanced properties to set the flags through the GUI, than it sets the Productions Flags to "Default, RemoveDates". Also I don't have the same flag options as in the screenshot at
http://blog.codefluententities.com/2013/04/22/remove-the-current-date-and-time-to-generated-files/
The screenshot has the following checked:
1. Remove Diffs: Remove Dates
2. Remove Dates
None of my options match those in the screenshot. The only one that appears similar is:
Remove Diffs <--- Note that the one in the screen shot has Remove Dates on the same line
Below is the model which was created using version/build 1.0.61214.805 of Codefluent Entities
<cf:project defaultNamespace="DemoRemoveDates" xmlns:cf="http://www.softfluent.com/codefluent/2005/1" xmlns:cfx="http://www.softfluent.com/codefluent/modeler/2008/1" xmlns:cfps="http://www.softfluent.com/codefluent/producers.sqlserver/2005/1" xmlns:cfom="http://www.softfluent.com/codefluent/producers.model/2005/1" xmlns:cfasp="http://www.softfluent.com/codefluent/producers.aspnet/2011/1" defaultConnectionString="Database=DemoRemoveDates;Server=.\SQLExpress;Integrated Security=true" defaultProducerProductionFlags="Default, RemoveDates" createDefaultMethodForms="true" createDefaultApplication="false" createDefaultHints="false">
<cf:import path="Default.Surface.cfp" />
<cf:producer enabled="false" productionFlags="None" name="SQL Server Producer" typeName="CodeFluent.Producers.SqlServer.SqlServerProducer, CodeFluent.Producers.SqlServer">
<cf:configuration connectionString="Database=DemoRemoveDates;Server=.\SQLExpress;Integrated Security=true" produceViews="true" targetVersion="Sql2008" targetDirectory="..\DemoRemoveDates.Persistence" cfx:targetProjectLayout="UpdateItems, DontRemove" cfx:targetProject="..\DemoRemoveDates.Persistence\DemoRemoveDates.Persistence.dbproj" />
</cf:producer>
<cf:producer productionFlags="None" name="BOM Producer" typeName="CodeFluent.Producers.CodeDom.CodeDomProducer, CodeFluent.Producers.CodeDom, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1bb6d7cccf1045ec">
<cf:configuration compileWithVisualStudio="true" targetDirectory="..\DemoRemoveDates" cfx:targetProject="..\DemoRemoveDates\DemoRemoveDates.csproj" cfx:targetProjectLayout="Update" />
</cf:producer>
<cf:producer enabled="false" productionFlags="None" name="ASP.NET WebForms Producer" typeName="CodeFluent.Producers.UI.AspNetProducer, CodeFluent.Producers.UI">
<cf:configuration categoryPath="UI\AspNetWebForms" targetDirectory="..\DemoRemoveDates.Web" cfx:targetProject="..\DemoRemoveDates.Web\DemoRemoveDates.Web.csproj" />
</cf:producer>
<cf:entity name="Contact" namespace="DemoRemoveDates" categoryPath="/DemoRemoveDates">
<cf:property name="Id" key="true" />
<cf:property name="Name" />
</cf:entity>
</cf:project>

This article is pretty old. Try using this value instead:
productionFlags="Default, RemoveDates"
Or use the modeler to set this:
For the BOM producer, you need to set one more flag:
productionFlags="Default, Overwrite, RemoveDates"
You can also define it at model stage:

Related

Substituting multiple variables in a list using a VSTS Release Definition

I am currently using variable substitution in VSTS however I have hit a roadblock on how to select specific elements from a list.
I must supply both a name for the variable I want to substitute and a key with which to substitute the old value. I can use . to select nested elements in config.
I have the following app.config.
<services>
<service behaviorConfiguration="ServiceBehaviour" name="Application.Project01">
<endpoint address="" behaviorConfiguration="webBehavior" binding="webHttpBinding" bindingConfiguration="web" contract="Application.Interface01">
<identity>
<dns value="dns01" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost/Project01/" />
</baseAddresses>
</host>
</service>
<service behaviorConfiguration="ServiceBehaviour" name="Application.Project02">
<endpoint address="" behaviorConfiguration="webBehavior" binding="webHttpBinding" bindingConfiguration="web" contract="Application.Interface02">
<identity>
<dns value="dns01" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost/Project02/" />
</baseAddresses>
</host>
</service>
</services>
I would like to be able to substitute variables in each one of these services individually. The specific keys I am interested in are services.service.endpoint.identity.dns.value and services.host.baseaddresses.add.baseaddress.
I have tried the following to edit the dns value
services.1.service.endpoint.identity.dns
services.1.service.endpoint.identity.dns.value
The task that I am using is the Azure App Service Deploy version 3.*
For XML variable substitution feature of Azure App Service Deploy task, it takes effect only on the applicationSettings, appSettings, connectionStrings, and configSections elements of configuration files.
So you can’t use it to achieve your requirement.
You can try it with XML Transformation.
You also can try it with other tasks, such as Release Management Utility tasks or others.

Unable to add custom prefix to generated views

I want to be able to add the prefix "cf_" to all stored procedures and views. I got it working with stored procedures but the same approach does not work with views. See screen shot for how I assigned custom prefixes.
Although I'm including the XML file, I prefer to use the property pages as opposed to editing the XML directly.
<cf:project defaultNamespace="DemoCustomPrefix" xmlns:cf="http://www.softfluent.com/codefluent/2005/1" xmlns:cfx="http://www.softfluent.com/codefluent/modeler/2008/1" xmlns:cfps="http://www.softfluent.com/codefluent/producers.sqlserver/2005/1" xmlns:cfom="http://www.softfluent.com/codefluent/producers.model/2005/1" xmlns:cfasp="http://www.softfluent.com/codefluent/producers.aspnet/2011/1" defaultTargetFramework="4.0" defaultConnectionString="Database=DemoCustomPrefix;Server=.\SQLExpress;Integrated Security=true" persistenceSaveProcedureFormat="cf_{0}_Save" persistenceLoadProcedureFormat="cf_{0}_{1}" persistenceSearchProcedureFormat="cf_{0}_{1}" persistenceDeleteProcedureFormat="cf_{0}_{1}" persistenceRawProcedureFormat="cf_{0}_{1}" viewFormat="cf_{0}" procedureFormat="cf_{0}" createDefaultMethodForms="true" createDefaultApplication="false" createDefaultHints="false">
<cf:import path="Default.Surface.cfp" />
<cf:producer name="SQL Server Producer" typeName="CodeFluent.Producers.SqlServer.SqlServerProducer, CodeFluent.Producers.SqlServer">
<cf:configuration connectionString="Database=DemoCustomPrefix;Server=.\SQLExpress;Integrated Security=true" produceViews="true" targetVersion="Sql2008" targetDirectory="..\DemoCustomPrefix.Persistence" cfx:targetProjectLayout="UpdateItems, DontRemove" cfx:targetProject="..\DemoCustomPrefix.Persistence\DemoCustomPrefix.Persistence.dbproj" />
</cf:producer>
<cf:producer name="BOM Producer" typeName="CodeFluent.Producers.CodeDom.CodeDomProducer, CodeFluent.Producers.CodeDom, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1bb6d7cccf1045ec">
<cf:configuration compileWithVisualStudio="true" targetDirectory="..\DemoCustomPrefix" cfx:targetProject="..\DemoCustomPrefix\DemoCustomPrefix.csproj" />
</cf:producer>
<cf:producer name="ASP.NET WebForms Producer" typeName="CodeFluent.Producers.UI.AspNetProducer, CodeFluent.Producers.UI">
<cf:configuration categoryPath="UI\AspNetWebForms" targetDirectory="..\DemoCustomPrefix.Web" cfx:targetProject="..\DemoCustomPrefix.Web\DemoCustomPrefix.Web.csproj" />
</cf:producer>
<cf:entity name="Widget" namespace="DemoCustomPrefix">
<cf:property name="Id" key="true" />
<cf:property name="Name" />
</cf:entity>
</cf:project>
Figured it out. Just had to select "Custom Formats" under for Naming Convention.

Self Hosted (console) WCF configuration

i had a WCF server running through a Console application, it will run as an azure service so i don't to host it in ISS.
I belived it work well and share datas to my web app through ajax request. But when i maked a service that recieve a filestream, i realized that my binding configuration is not used at all. My WCF work same without binding section.
My probleme concerne especially the key "maxReceivedMessageSize" because default value limit me to 8Ko request and it is a problem for uploading file.
Bindings section (that i can comment) :
<webHttpBinding>
<binding name="MyBindingConfig" crossDomainScriptAccessEnabled="true" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Buffered">
<readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None" />
</binding>
</webHttpBinding>
Services section :
<service name="MyData.Service.MyDataServiceRestFull">
<endpoint binding="webHttpBinding"
contract="MyData.Service.IMyDataServiceRestFull" bindingName="MyBindingConfig" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:9997/MyDataServer"/>
</baseAddresses>
</host>
</service>
Note that i tryed with basicHttpBinding and i had same issue.
The problem is that you're incorrectly referring to your binding in your <endpoint/> element. You're using the bindingName attribute, when you should be using the bindingConfiguration attribute:
<endpoint binding="webHttpBinding"
contract="MyData.Service.IMyDataServiceRestFull"
bindingConfiguration="MyBindingConfig" />

Pivot Script Producer - Bug Found

I'm sorry to have to submit through this channel.
The report issue feature on your website won't just let me submit my request. Error enclosed:
SoftFluent, SoftFluent, we have a problem! An unidentified error has occured
Problem: Pivot Script producer crashes
Reproductible: Yes
Use case:
Basic use case is having 2 entities named the same (concept is the same but spreaded over different namespace and schema), yet referencing a third entity.
After extending SqlPivotProducer, it appears that referenced table would find its constraints (1 PK and 2 FK) but one of the 2 FK would have a null ReferenceTable leading to nullpointer.
Steps to reproduce:
Have this model below and try to generate Pivot Script File
<cf:project defaultNamespace="Model1" xmlns:cf="http://www.softfluent.com/codefluent/2005/1" xmlns:cfx="http://www.softfluent.com/codefluent/modeler/2008/1" xmlns:cfsps="http://www.softfluent.com/codefluent/producers.sqlpivotscript/2013/1" xmlns:cfps="http://www.softfluent.com/codefluent/producers.sqlserver/2005/1" xmlns:cfspsi="http://www.softfluent.com/codefluent/producers.ixcyssqlpivotscript/2016/1" createDefaultMethodForms="true" createDefaultApplication="false" createDefaultHints="false">
<cf:import path="Default.Surface.cfp" />
<cf:entity name="Entity" schema="SchemaA" namespace="Model1.NamespaceA" persistenceName="Entity">
<cf:property name="EntityId" key="true" />
<cf:property name="EntityC" typeName="{0}.NamespaceC.EntityC" />
</cf:entity>
<cf:entity name="Entity" schema="SchemaB" namespace="Model1.NamespaceB" persistenceName="Entity">
<cf:property name="EntityId" key="true" />
<cf:property name="EntityC" typeName="{0}.NamespaceC.EntityC" />
</cf:entity>
<cf:entity name="EntityC" namespace="Model1.NamespaceC">
<cf:property name="EntityCId" key="true" />
</cf:entity>
<cf:producer name="SQL Server Pivot Script" typeName="CodeFluent.Producers.SqlServer.SqlPivotScriptProducer, CodeFluent.Producers.SqlServer">
<cf:configuration targetDirectory="..\Database1" connectionString="Server=127.0.0.1;Database=EntityA;Integrated Security=true;Application Name=Application;" cfx:targetProject="..\Database1\Database1.sqlproj" cfx:targetProjectLayout="Update" />
</cf:producer>
<cf:producer enabled="false" name="SQL Server" typeName="CodeFluent.Producers.SqlServer.SqlServerProducer, CodeFluent.Producers.SqlServer">
<cf:configuration produceViews="true" targetDirectory="..\Database1" connectionString="Server=127.0.0.1;Database=EntityA;Integrated Security=true;Application Name=FedPeche33_Association;" cfx:targetProject="..\Database1\Database1.sqlproj" cfx:targetProjectLayout="Update, DontRemove" produceSchemas="true" />
</cf:producer>
<cf:producer enabled="false" name="Asp.Net Identity" typeName="CodeFluent.Producers.SqlServer.IxcysSqlPivotScriptProducer, SqlServerPivotIxcys">
<cf:configuration targetDirectory="..\Database1" cfx:targetProject="..\Database1\Database1.sqlproj" cfx:targetProjectLayout="Update" connectionString="Server=127.0.0.1;Database=EntityA;Integrated Security=true;Application Name=FedPeche33_Association;" />
</cf:producer>
</cf:project>
Captured stacktrace:
System.NullReferenceException was unhandled
Message: An unhandled exception of type 'System.NullReferenceException' occurred in CodeFluent.Producers.SqlServer.dll
Additional information: Object reference not set to an instance of an object.
For the time being I would consider renaming my entities to go over this problem.
Thanks for your support
I also had this non-blocking exception on my environment while debugging pivot script generation:
DateTimeInvalidLocalFormat occurred
Message: Managed Debugging Assistant 'DateTimeInvalidLocalFormat' has detected a problem in 'C:\Program Files (x86)\SoftFluent\CodeFluent\Modeler\CodeFluent.Build4.exe'.
Additional information: A UTC DateTime is being converted to text in a format that is only correct for local times. This can happen when calling DateTime.ToString using the 'z' format specifier, which will include a local time zone offset in the output. In that case, either use the 'Z' format specifier, which designates a UTC time, or use the 'o' format string, which is the recommended way to persist a DateTime in text. This can also occur when passing a DateTime to be serialized by XmlConvert or DataSet. If using XmlConvert.ToString, pass in XmlDateTimeSerializationMode.RoundtripKind to serialize correctly. If using DataSet, set the DateTimeMode on the DataColumn object to DataSetDateTime.Utc.

How do I convince the Visual Studio Publish Web wizard that my database is Entity Framework CodeFirst?

In VS2015 when I open an existing publish profile in the publish wizard, it immediately decides that my default database is no longer EF CodeFirst and removes the option to Execute Code First Migrations and replaces it with Update Database.
Somehow, the wizard seems to be deciding that this is no longer a CodeFirst Project and is replacing it with DbDacFx like so:
<PublishDatabaseSettings>
<Objects xmlns="">
<ObjectGroup Name="DefaultConnection" Order="1" Enabled="True">
<Destination Path="Data Source=*" />
<Object Type="DbCodeFirst">
<Source Path="DBMigration" DbContext="m4d.Context.DanceMusicContext, m4d" MigrationConfiguration="m4d.Migrations.Configuration, m4d" Origin="Configuration" />
</Object>
</ObjectGroup>
</Objects>
</PublishDatabaseSettings>
Transforms to:
<PublishDatabaseSettings>
<Objects xmlns="">
<ObjectGroup Name="DefaultConnection" Order="1" Enabled="False">
<Destination Path="Data Source=*" />
<Object Type="DbDacFx">
<PreSource Path="Data Source=*" includeData="False" />
<Source Path="$(IntermediateOutputPath)AutoScripts\DefaultConnection_IncrementalSchemaOnly.dacpac" dacpacAction="Deploy" />
</Object>
<UpdateFrom Type="Web.Config">
<Source MatchValue="Data Source=*" MatchAttributes="$(UpdateFromConnectionStringAttributes)" />
</UpdateFrom>
</ObjectGroup>
</Objects>
</PublishDatabaseSettings>
(I replaced the various connection strings with *)
Anyone have any idea what the wizard uses to decide that this is a CodeFirst Project?
This article http://blogs.msdn.com/b/webdev/archive/2014/04/09/ef-code-first-migrations-deployment-to-an-azure-cloud-service.aspx provides some details of how to roll one's own version of the Execute Code First Migrations option, and is a potential workaround, but it used to just work.
In your .pubxml file, you must rename the ObjectGroup as the full name of your Dbcontext: m4d.Migrations.Configuration. Otherwise, it seems to be ignored.
<PublishDatabaseSettings>
<Objects xmlns="">
<ObjectGroup Name="m4d.Migrations.Configuration" Order="1" Enabled="True">
<Destination Path="Data Source=*" />
<Object Type="DbCodeFirst">
<Source Path="DBMigration" DbContext="m4d.Context.DanceMusicContext, m4d" MigrationConfiguration="m4d.Migrations.Configuration, m4d" Origin="Configuration" />
</Object>
</ObjectGroup>
</Objects>
</PublishDatabaseSettings>