Giter Club home page Giter Club logo

datavers-gen-cli's People

Contributors

bpedziwiatr avatar bpedziwiatr-sii avatar c485 avatar mgrabski-sii avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

swidz

datavers-gen-cli's Issues

C# Fields for EnvironmentVariableDefinition entity generates two SchemaName consts in .fields class

Input: EnvironmentVariableDefinition entity to be generated for c# model
output: fields class contains two definitions for schemaName since Schemaname is generated from entity schema name and Schema name field on EnviromentVariableDefinition.

public const string SchemaName = "environmentvariabledefinition";
public const string SchemaName = "schemaname";

suggested fix: rename Schemaname generated from entityname to EntitySchemaName

config.json - change string to array

Example:
{ "Entities": ["account", "contact", "systemuser" ], "ConnectionString": "", "Namespace": "Dataverse.Entities", "OutDirectory": "Entities", "TemplateName": "ProjectTemplate", "TemplateEngine": { "IsSingleOutput": false, "Name": "scriban", "Type": "C#" } }

Change WelcomeXml to meet eslint requirments

Change WelcomeXml to meet eslint requirments:

  • remove space on end of the line
  • add space after //

Example:

        WelcomeXml = $@"

// ------------------------------------------------------------------------------
//
// This code was generated by a Dataverse-Cli.
// Runtime Version: {assemblyVersion}
// File Version: {assemblyFileVersion.FileVersion}
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
// ------------------------------------------------------------------------------";

Disable loop limit in TemplateContext

Unhandled Exception: Scriban.Syntax.ScriptRuntimeException: (259,7) : error : Exceeding number of iteration limit 1000 for loop statement.

Need to change:
de4a29e4-59df-4db0-b512-16603d241577

Update template

get => GetRelatedEntities<{{attribute.to_entity.hybrid_name}}>("{{attribute.schema_name}}",{{attribute.entity_role}});

Cannot implicitly convert type 'Contoso.Dataverse.DataAccess.Entities.Dataverse.SystemUser' to 'System.Collections.Generic.IEnumerable<Contoso.Dataverse.DataAccess.Entities.Dataverse.SystemUser>'. An explicit conversion exists (are you missing a cast?)

add explicit type:

get => (IEnumerable<{{attribute.to_entity.hybrid_name}}>) GetRelatedEntities<{{attribute.to_entity.hybrid_name}}>("{{attribute.schema_name}}",{{attribute.entity_role}});

enums.sbncs 'is' value is restricted

{{info.welcome_xml}}
namespace {{ namespace }}
{
public partial class {{entity.hybrid_name}}
{
public class Enums
{
{{for enm in entity.enums}}
public enum {{enm.display_name}}
{
{{for item in enm.items}}
{{if item.name != "is" }}
{{item.name}} = {{item.value}},
{{else}}
{{item.name}}_ = {{item.value}},
{{end}}
{{end}}
}
{{end}}
}
}
}

Generate lookup name as props (optional in config)

Example:
return crmQuery.Where(p => p.erpid == erpid && p.company.Name.Equals(companyId)); //this will return error/invalid query
Example thah works:
return crmQuery.Where(p => p.erpid == erpid && p["companyname"].Equals(companyId)); //this will work

What should be possible:
return crmQuery.Where(p => p.erpid == erpid && p.companyName.Equals(companyId)); //this will be equal to example above

update C# generated entities template to use consts instead of hardcoded strings

  Before: 
    /// <summary>
    /// Unique entity name.
    /// </summary>
    [AttributeLogicalName("schemaname")]
    public string SchemaName
    {					
        get =>  GetAttributeValue<string>("schemaname");
        set
        {
            OnPropertyChanging("SchemaName");
            SetAttributeValue("schemaname", value);
            OnPropertyChanged("SchemaName");
        }
    }
    After: 
    /// <summary>
    /// Unique entity name.
    /// </summary>
    [AttributeLogicalName(Fields.SchemaName)]
    public string SchemaName
    {					
        get =>  GetAttributeValue<string>(Fields.SchemaName);
        set
        {
            OnPropertyChanging(Fields.SchemaName);
            SetAttributeValue(Fields.SchemaName, value);
            OnPropertyChanged(Fields.SchemaName);
        }
    }

Typescript metadata enum key differs from the CRM optionset label

Issue:
When creating metadata for ts optionset keys do not match exactly optionset labels from CRM. See example in the image below (whitespace and special characters are removed)

Example Expected OptionSet label (Enum Key) "Potwierdź Zamówienie"
Example Actual Enum Key "Potwierdzzamowienie"
image

Config validation

  1. every entity added by internal logic should be optional, so in this case adding activityparty should result in generation of only one entry in XrmServiceContext
  2. There should be validation for duplicated entries in entities list

image

Error after adding new field of type File

Retrieving All Entities
All Entities  Retrieved
Retrieving Selected Entities
All Selected Entities Retrieved

System.InvalidOperationException: Sequence contains no matching element
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
   at DataverseGen.Core.Metadata.MappingRelationshipN1.Parse(OneToManyRelationshipMetadata rel, MappingField[] properties)
   at DataverseGen.Core.Metadata.MappingEntity.<>c__DisplayClass71_0.<Parse>b__10(OneToManyRelationshipMetadata r)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at DataverseGen.Core.Metadata.MappingEntity.Parse(EntityMetadata entityMetadata)
   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at DataverseGen.Core.DataConverter.DataverseConnector.GetMappedEntities()
   at DataverseGen.Cli.Program.Main(String[] args)
#StackTrace:
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
   at DataverseGen.Core.Metadata.MappingRelationshipN1.Parse(OneToManyRelationshipMetadata rel, MappingField[] properties)
   at DataverseGen.Core.Metadata.MappingEntity.<>c__DisplayClass71_0.<Parse>b__10(OneToManyRelationshipMetadata r)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at DataverseGen.Core.Metadata.MappingEntity.Parse(EntityMetadata entityMetadata)
   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at DataverseGen.Core.DataConverter.DataverseConnector.GetMappedEntities()
   at DataverseGen.Cli.Program.Main(String[] args)

Unhandled Exception: System.InvalidOperationException: Sequence contains no matching element
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
   at DataverseGen.Core.Metadata.MappingRelationshipN1.Parse(OneToManyRelationshipMetadata rel, MappingField[] properties)
   at DataverseGen.Core.Metadata.MappingEntity.<>c__DisplayClass71_0.<Parse>b__10(OneToManyRelationshipMetadata r)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at DataverseGen.Core.Metadata.MappingEntity.Parse(EntityMetadata entityMetadata)
   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.OrderedEnumerable`1.<GetEnumerator>d__1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at DataverseGen.Core.DataConverter.DataverseConnector.GetMappedEntities()
   at DataverseGen.Cli.Program.Main(String[] args)
Bye Bye, see you next time Press any Key to exit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.